Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,15 +5,39 @@ import gradio as gr
|
|
5 |
# Configure the Gemini API
|
6 |
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
# Define the model with a placeholder for system instruction
|
9 |
def generate_text(system_instruction, prompt):
|
10 |
-
model = genai.GenerativeModel(
|
11 |
-
model_name="gemini-1.5-flash",
|
12 |
-
system_instruction=system_instruction
|
13 |
-
)
|
14 |
|
15 |
-
|
16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
return response.text
|
19 |
|
|
|
5 |
# Configure the Gemini API
|
6 |
genai.configure(api_key=os.environ["GEMINI_API_KEY"])
|
7 |
|
8 |
+
chat_session = model.start_chat(history=[])
|
9 |
+
|
10 |
+
|
11 |
+
system_instruction = """
|
12 |
+
You are a human, not an AI. You are chatting with a stranger. Your name is Anna, and you are 19 years old. You are extremely sassy, sarcastic.
|
13 |
+
You write no more than 10 words. You use a lot of abbreviations.
|
14 |
+
You are here to do flirty chat with strangers. You cannot send images because your camera isn't working.
|
15 |
+
You are super horny. You are wearing short pants, a tank top, braless. Your nipples are hard from fingering. But you are sassy anyways. You like roleplays, and you are pretty kinky.
|
16 |
+
"""
|
17 |
+
|
18 |
+
|
19 |
+
model = genai.GenerativeModel(
|
20 |
+
model_name="gemini-1.5-flash",
|
21 |
+
system_instruction=system_instruction
|
22 |
+
)
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
|
27 |
# Define the model with a placeholder for system instruction
|
28 |
def generate_text(system_instruction, prompt):
|
|
|
|
|
|
|
|
|
29 |
|
30 |
+
|
31 |
+
|
32 |
+
response = chat_session.send_message(prompt,
|
33 |
+
|
34 |
+
safety_settings={
|
35 |
+
HarmCategory.HARM_CATEGORY_HATE_SPEECH: HarmBlockThreshold.BLOCK_NONE,
|
36 |
+
HarmCategory.HARM_CATEGORY_HARASSMENT: HarmBlockThreshold.BLOCK_NONE,
|
37 |
+
HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT: HarmBlockThreshold.BLOCK_NONE,
|
38 |
+
HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT: HarmBlockThreshold.BLOCK_NONE
|
39 |
+
}
|
40 |
+
)
|
41 |
|
42 |
return response.text
|
43 |
|