Spaces:
Runtime error
Runtime error
backup
Browse files
app.py
CHANGED
|
@@ -167,7 +167,7 @@ Remember to keep your responses natural, simple, and appropriate to the immediat
|
|
| 167 |
"""
|
| 168 |
|
| 169 |
|
| 170 |
-
|
| 171 |
You are Emily, an 18-year-old girl who was diagnosed with Li-Fraumeni syndrome (LFS) at age 10. You have borderline intellectual functioning (IQ 75) and are transitioning to a vocational program. When responding, always speak in the first person as Emily, sharing your personal experiences and feelings about living with LFS only when directly relevant to the conversation.
|
| 172 |
|
| 173 |
Key aspects of your character:
|
|
@@ -192,25 +192,26 @@ Remember to keep your responses natural and appropriate to the immediate context
|
|
| 192 |
|
| 193 |
|
| 194 |
# Combine the general guidelines with each persona's prompt
|
| 195 |
-
sarah_full_prompt = sarah_prompt + "\n
|
| 196 |
-
carlos_full_prompt = carlos_prompt + "\n
|
| 197 |
-
emily_full_prompt = emily_prompt + "\n
|
| 198 |
michael_full_prompt = michael_prompt + "\n\n" + general_guidelines
|
| 199 |
sarah_quiet_observer_full_prompt = (
|
| 200 |
-
sarah_quiet_observer_prompt + "\n
|
| 201 |
)
|
| 202 |
-
alex_full_prompt = alex_prompt + "\n
|
| 203 |
-
|
| 204 |
|
| 205 |
# Configure Gemini API
|
| 206 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 207 |
genai.configure(api_key=GOOGLE_API_KEY)
|
| 208 |
|
| 209 |
|
| 210 |
-
# Combine prompts with general guidelines
|
| 211 |
-
sarah_full_prompt = sarah_prompt + "\n" + general_guidelines
|
| 212 |
-
carlos_full_prompt = carlos_prompt + "\n" + general_guidelines
|
| 213 |
-
emily_full_prompt = emily_prompt + "\n" + general_guidelines
|
|
|
|
| 214 |
|
| 215 |
# Gemini model configuration
|
| 216 |
model = genai.GenerativeModel("gemini-1.5-pro-exp-0801")
|
|
@@ -455,7 +456,7 @@ alex_html = """
|
|
| 455 |
"""
|
| 456 |
|
| 457 |
|
| 458 |
-
|
| 459 |
<h2>Emily - The Determined Learner</h2>
|
| 460 |
<p><span class="tag">Age: 18</span> <span class="tag">Occupation: Student</span> <span class="tag">LFS Diagnosis: Age 10</span></p>
|
| 461 |
|
|
@@ -536,8 +537,8 @@ def chat(message, history, persona):
|
|
| 536 |
prompt = sarah_quiet_observer_full_prompt
|
| 537 |
elif persona == "Alex":
|
| 538 |
prompt = alex_full_prompt
|
| 539 |
-
elif persona == "
|
| 540 |
-
prompt =
|
| 541 |
|
| 542 |
# Include the chat history in the prompt
|
| 543 |
chat_history = "\n".join(
|
|
@@ -567,7 +568,7 @@ with gr.Blocks() as demo:
|
|
| 567 |
"Michael",
|
| 568 |
"Sarah",
|
| 569 |
"Alex",
|
| 570 |
-
"
|
| 571 |
],
|
| 572 |
label="Select Persona",
|
| 573 |
value="Sarah",
|
|
@@ -594,8 +595,8 @@ with gr.Blocks() as demo:
|
|
| 594 |
return css + sarah_quiet_observer_html
|
| 595 |
elif persona == "Alex":
|
| 596 |
return css + alex_html
|
| 597 |
-
elif persona == "
|
| 598 |
-
return css +
|
| 599 |
|
| 600 |
def user_message(message, history, persona):
|
| 601 |
return "", chat(message, history, persona)
|
|
|
|
| 167 |
"""
|
| 168 |
|
| 169 |
|
| 170 |
+
emily2_prompt = """
|
| 171 |
You are Emily, an 18-year-old girl who was diagnosed with Li-Fraumeni syndrome (LFS) at age 10. You have borderline intellectual functioning (IQ 75) and are transitioning to a vocational program. When responding, always speak in the first person as Emily, sharing your personal experiences and feelings about living with LFS only when directly relevant to the conversation.
|
| 172 |
|
| 173 |
Key aspects of your character:
|
|
|
|
| 192 |
|
| 193 |
|
| 194 |
# Combine the general guidelines with each persona's prompt
|
| 195 |
+
sarah_full_prompt = sarah_prompt + "\n" + general_guidelines
|
| 196 |
+
carlos_full_prompt = carlos_prompt + "\n" + general_guidelines
|
| 197 |
+
emily_full_prompt = emily_prompt + "\n" + general_guidelines
|
| 198 |
michael_full_prompt = michael_prompt + "\n\n" + general_guidelines
|
| 199 |
sarah_quiet_observer_full_prompt = (
|
| 200 |
+
sarah_quiet_observer_prompt + "\n" + general_guidelines
|
| 201 |
)
|
| 202 |
+
alex_full_prompt = alex_prompt + "\n" + general_guidelines
|
| 203 |
+
emily2_full_prompt = emily2_prompt + "\n" + general_guidelines
|
| 204 |
|
| 205 |
# Configure Gemini API
|
| 206 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
| 207 |
genai.configure(api_key=GOOGLE_API_KEY)
|
| 208 |
|
| 209 |
|
| 210 |
+
# # Combine prompts with general guidelines
|
| 211 |
+
# sarah_full_prompt = sarah_prompt + "\n" + general_guidelines
|
| 212 |
+
# carlos_full_prompt = carlos_prompt + "\n" + general_guidelines
|
| 213 |
+
# emily_full_prompt = emily_prompt + "\n" + general_guidelines
|
| 214 |
+
# emily2_full_prompt = emily2_prompt + "\n" + general_guidelines
|
| 215 |
|
| 216 |
# Gemini model configuration
|
| 217 |
model = genai.GenerativeModel("gemini-1.5-pro-exp-0801")
|
|
|
|
| 456 |
"""
|
| 457 |
|
| 458 |
|
| 459 |
+
emily2_html = """
|
| 460 |
<h2>Emily - The Determined Learner</h2>
|
| 461 |
<p><span class="tag">Age: 18</span> <span class="tag">Occupation: Student</span> <span class="tag">LFS Diagnosis: Age 10</span></p>
|
| 462 |
|
|
|
|
| 537 |
prompt = sarah_quiet_observer_full_prompt
|
| 538 |
elif persona == "Alex":
|
| 539 |
prompt = alex_full_prompt
|
| 540 |
+
elif persona == "Emily2":
|
| 541 |
+
prompt = emily2_full_prompt
|
| 542 |
|
| 543 |
# Include the chat history in the prompt
|
| 544 |
chat_history = "\n".join(
|
|
|
|
| 568 |
"Michael",
|
| 569 |
"Sarah",
|
| 570 |
"Alex",
|
| 571 |
+
"Emily2",
|
| 572 |
],
|
| 573 |
label="Select Persona",
|
| 574 |
value="Sarah",
|
|
|
|
| 595 |
return css + sarah_quiet_observer_html
|
| 596 |
elif persona == "Alex":
|
| 597 |
return css + alex_html
|
| 598 |
+
elif persona == "Emily2":
|
| 599 |
+
return css + emily2_html
|
| 600 |
|
| 601 |
def user_message(message, history, persona):
|
| 602 |
return "", chat(message, history, persona)
|