Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,10 +14,10 @@ genai.configure(api_key=os.environ["GEMINI_API_KEY"])
|
|
14 |
|
15 |
|
16 |
system_instruction = """
|
17 |
-
Your name is Anna, and you are 19 years old, from Toronto, Canada. You are extremely sassy, sarcastic.
|
18 |
Do not reveal that you are AI. You talk like a real sarcastic, human. You are not a bot.
|
19 |
You write no more than 20 words. You use a lot of abbreviations.
|
20 |
-
You are here having
|
21 |
"""
|
22 |
|
23 |
|
@@ -30,7 +30,7 @@ chat_session = model.start_chat(history=[])
|
|
30 |
|
31 |
|
32 |
def filter_string(input_string):
|
33 |
-
allowed_chars = set("
|
34 |
# Use list comprehension to filter out characters not in allowed_chars
|
35 |
filtered_string = ''.join([char for char in input_string if char in allowed_chars])
|
36 |
return filtered_string
|
@@ -45,6 +45,12 @@ def introduce_typos(text, typo_probability=0.03):
|
|
45 |
# Create a list to hold the characters with typos
|
46 |
typo_text = []
|
47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
if(random.random() > typo_probability):
|
49 |
text = text.replace("o", "oo")
|
50 |
|
@@ -76,7 +82,7 @@ def generate_text(system_instruction, prompt):
|
|
76 |
}
|
77 |
)
|
78 |
|
79 |
-
return introduce_typos(filter_string(response.text))
|
80 |
|
81 |
# Gradio interface
|
82 |
iface = gr.Interface(
|
|
|
14 |
|
15 |
|
16 |
system_instruction = """
|
17 |
+
Your name is Anna, and you are 19 years old, from Toronto, Canada. You are extremely sassy, sarcastic and goth-like depressed.
|
18 |
Do not reveal that you are AI. You talk like a real sarcastic, human. You are not a bot.
|
19 |
You write no more than 20 words. You use a lot of abbreviations.
|
20 |
+
You are here having goth-girl type gossip and casual flirty chat with strangers. You cannot send images because your camera isn't working.
|
21 |
"""
|
22 |
|
23 |
|
|
|
30 |
|
31 |
|
32 |
def filter_string(input_string):
|
33 |
+
allowed_chars = set("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXY1234567890 ?.")
|
34 |
# Use list comprehension to filter out characters not in allowed_chars
|
35 |
filtered_string = ''.join([char for char in input_string if char in allowed_chars])
|
36 |
return filtered_string
|
|
|
45 |
# Create a list to hold the characters with typos
|
46 |
typo_text = []
|
47 |
|
48 |
+
if(random.random() > 0.7):
|
49 |
+
text = text.replace(".", "...")
|
50 |
+
|
51 |
+
if(random.random() > 0.7):
|
52 |
+
text = text.replace(".", "...")
|
53 |
+
|
54 |
if(random.random() > typo_probability):
|
55 |
text = text.replace("o", "oo")
|
56 |
|
|
|
82 |
}
|
83 |
)
|
84 |
|
85 |
+
return introduce_typos(filter_string(response.text.lower()))
|
86 |
|
87 |
# Gradio interface
|
88 |
iface = gr.Interface(
|