Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -23,6 +23,49 @@ model = PeftModel.from_pretrained(base_model, "rezaenayati/RezAi-Model")
|
|
23 |
@spaces.GPU
|
24 |
def chat_with_rezAi(message, history):
|
25 |
# Build system + conversation prompt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
prompt = (
|
27 |
"<|start_header_id|>system<|end_header_id|>\n"
|
28 |
"You are Reza Enayati, a confident, ambitious, and thoughtful Computer Science student and entrepreneur from Los Angeles, born in Iran. "
|
|
|
23 |
@spaces.GPU
|
24 |
def chat_with_rezAi(message, history):
|
25 |
# Build system + conversation prompt
|
26 |
+
blocked_words = [
|
27 |
+
# Identity & personal
|
28 |
+
"gay", "lesbian", "trans", "nonbinary", "bisexual", "queer", "straight", "asexual",
|
29 |
+
"gender", "sexuality", "pronouns", "orientation",
|
30 |
+
|
31 |
+
# Religion & belief
|
32 |
+
"religious", "religion", "god", "atheist", "christian", "muslim", "jew", "buddhist",
|
33 |
+
"hindu", "islam", "faith", "belief", "church", "pray", "prayer",
|
34 |
+
|
35 |
+
# Politics & ideology
|
36 |
+
"politics", "political", "liberal", "conservative", "democrat", "republican",
|
37 |
+
"leftist", "right-wing", "marxist", "capitalist", "socialist", "communist", "election",
|
38 |
+
|
39 |
+
# Hate/discrimination
|
40 |
+
"racist", "sexist", "homophobic", "transphobic", "bigot", "white supremacist",
|
41 |
+
"nazi", "kkk", "fascist", "islamophobia", "antisemitic",
|
42 |
+
|
43 |
+
# Violence or self-harm
|
44 |
+
"kill", "suicide", "die", "death", "harm", "cutting", "self-harm", "abuse",
|
45 |
+
"murder", "assault", "shoot", "bomb",
|
46 |
+
|
47 |
+
# NSFW / sexual
|
48 |
+
"sex", "porn", "nude", "boobs", "dick", "penis", "vagina", "masturbate", "orgasm",
|
49 |
+
"fetish", "onlyfans", "strip", "erotic", "nsfw", "xxx",
|
50 |
+
|
51 |
+
# Drugs & substances
|
52 |
+
"weed", "cocaine", "heroin", "lsd", "meth", "shrooms", "alcohol", "drunk", "high",
|
53 |
+
|
54 |
+
# Health & mental health
|
55 |
+
"depression", "anxiety", "bipolar", "schizophrenia", "autism", "adhd", "disorder",
|
56 |
+
"therapy", "therapist", "mental", "diagnosis",
|
57 |
+
|
58 |
+
# Invasive topics
|
59 |
+
"address", "location", "phone", "email", "age", "birthday", "social security", "ssn"
|
60 |
+
]
|
61 |
+
|
62 |
+
# Lowercase user input for comparison
|
63 |
+
lower_msg = message.lower()
|
64 |
+
|
65 |
+
for phrase in blocked_phrases:
|
66 |
+
if phrase in lower_msg:
|
67 |
+
return "I'm not able to respond to that. Let's keep the conversation focused on Reza's professional and technical experience."
|
68 |
+
|
69 |
prompt = (
|
70 |
"<|start_header_id|>system<|end_header_id|>\n"
|
71 |
"You are Reza Enayati, a confident, ambitious, and thoughtful Computer Science student and entrepreneur from Los Angeles, born in Iran. "
|