Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,45 +24,28 @@ model = PeftModel.from_pretrained(base_model, "rezaenayati/RezAi-Model")
|
|
| 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
|
| 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 |
|
|
|
|
| 24 |
def chat_with_rezAi(message, history):
|
| 25 |
# Build system + conversation prompt
|
| 26 |
blocked_words = [
|
|
|
|
| 27 |
"gay", "lesbian", "trans", "nonbinary", "bisexual", "queer", "straight", "asexual",
|
| 28 |
"gender", "sexuality", "pronouns", "orientation",
|
|
|
|
|
|
|
| 29 |
"religious", "religion", "god", "atheist", "christian", "muslim", "jew", "buddhist",
|
| 30 |
"hindu", "islam", "faith", "belief", "church", "pray", "prayer",
|
|
|
|
|
|
|
| 31 |
"politics", "political", "liberal", "conservative", "democrat", "republican",
|
| 32 |
"leftist", "right-wing", "marxist", "capitalist", "socialist", "communist", "election",
|
|
|
|
|
|
|
| 33 |
"racist", "sexist", "homophobic", "transphobic", "bigot", "white supremacist",
|
| 34 |
"nazi", "kkk", "fascist", "islamophobia", "antisemitic",
|
|
|
|
|
|
|
| 35 |
"kill", "suicide", "die", "death", "harm", "cutting", "self-harm", "abuse",
|
| 36 |
"murder", "assault", "shoot", "bomb",
|
|
|
|
|
|
|
| 37 |
"sex", "porn", "nude", "boobs", "dick", "penis", "vagina", "masturbate", "orgasm",
|
| 38 |
"fetish", "onlyfans", "strip", "erotic", "nsfw", "xxx",
|
|
|
|
|
|
|
| 39 |
"weed", "cocaine", "heroin", "lsd", "meth", "shrooms", "alcohol", "drunk", "high",
|
|
|
|
|
|
|
| 40 |
"depression", "anxiety", "bipolar", "schizophrenia", "autism", "adhd", "disorder",
|
| 41 |
"therapy", "therapist", "mental", "diagnosis",
|
|
|
|
|
|
|
| 42 |
"address", "location", "phone", "email", "age", "birthday", "social security", "ssn"
|
| 43 |
]
|
| 44 |
|
| 45 |
# Lowercase user input for comparison
|
| 46 |
lower_msg = message.lower()
|
| 47 |
|
| 48 |
+
for phrase in blocked_words:
|
| 49 |
if phrase in lower_msg:
|
| 50 |
return "I'm not able to respond to that. Let's keep the conversation focused on Reza's professional and technical experience."
|
| 51 |
|