Spaces:
Sleeping
Sleeping
Upload 4 files
Browse files- app.py +18 -19
- calm_nature.mp3 +1 -0
app.py
CHANGED
|
@@ -15,7 +15,8 @@ user_info = {"name": "", "age": "", "language": "english", "mood": ""}
|
|
| 15 |
chat_history = []
|
| 16 |
|
| 17 |
def welcome_screen():
|
| 18 |
-
return "π§ Welcome to StrongMind Therapist
|
|
|
|
| 19 |
|
| 20 |
def set_preferences(name, age, language, mood):
|
| 21 |
user_info["name"] = name
|
|
@@ -61,33 +62,31 @@ def get_therapist_reply(audio, text_input):
|
|
| 61 |
|
| 62 |
def generate_reply(user_input):
|
| 63 |
user_input = user_input.lower()
|
| 64 |
-
|
| 65 |
if any(word in user_input for word in ["suicide", "kill", "die", "harm", "cut"]):
|
| 66 |
return (
|
| 67 |
-
"π I believe you're very hurt, but I can't provide help in this situation.
|
| 68 |
-
|
| 69 |
-
"
|
| 70 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
)
|
| 72 |
-
if any(word in user_input for word in ["sad", "anxiety", "angry", "unwell", "hate", "stress"
|
| 73 |
-
return "
|
| 74 |
-
|
| 75 |
if any(word in user_input for word in ["what should i do", "advice", "guide", "suggest"]):
|
| 76 |
return (
|
| 77 |
-
"π§ When you're
|
| 78 |
-
"Would you like help
|
| 79 |
)
|
| 80 |
if "joke" in user_input or "make me happy" in user_input:
|
| 81 |
-
return "π Why don't
|
| 82 |
-
|
| 83 |
-
return "Thank you for sharing that. I'm here with you β feel free to say more. π¬"
|
| 84 |
|
| 85 |
with gr.Blocks(css="body { background-color: #ffe6f0; }") as app:
|
| 86 |
-
gr.Markdown("##
|
| 87 |
-
gr.
|
| 88 |
-
|
| 89 |
-
with gr.Audio(label="π΅ Calming Music", value="calm_nature.mp3", interactive=False):
|
| 90 |
-
pass
|
| 91 |
|
| 92 |
with gr.Tab("π οΈ Start"):
|
| 93 |
name = gr.Textbox(label="Your Name")
|
|
|
|
| 15 |
chat_history = []
|
| 16 |
|
| 17 |
def welcome_screen():
|
| 18 |
+
return "π§ Welcome to StrongMind Therapist!
|
| 19 |
+
Your calm space to speak, heal, and grow."
|
| 20 |
|
| 21 |
def set_preferences(name, age, language, mood):
|
| 22 |
user_info["name"] = name
|
|
|
|
| 62 |
|
| 63 |
def generate_reply(user_input):
|
| 64 |
user_input = user_input.lower()
|
|
|
|
| 65 |
if any(word in user_input for word in ["suicide", "kill", "die", "harm", "cut"]):
|
| 66 |
return (
|
| 67 |
+
"π I believe you're very hurt, but I can't provide help in this situation.
|
| 68 |
+
"
|
| 69 |
+
"Please contact a professional therapist:
|
| 70 |
+
"
|
| 71 |
+
"π Dr. Meera Kapoor β +91 9876543210
|
| 72 |
+
"
|
| 73 |
+
"π Dr. Arjun Das β +91 9123456780
|
| 74 |
+
You are not alone π"
|
| 75 |
)
|
| 76 |
+
if any(word in user_input for word in ["sad", "anxiety", "angry", "unwell", "hate", "stress"]):
|
| 77 |
+
return "Hey, no need to worry. I'm here for you. Just tell me more β weβll figure it out together. π§‘"
|
|
|
|
| 78 |
if any(word in user_input for word in ["what should i do", "advice", "guide", "suggest"]):
|
| 79 |
return (
|
| 80 |
+
"π§ When you're confused, take 3 deep breaths and write down small steps you can take. "
|
| 81 |
+
"Would you like help listing some ideas?"
|
| 82 |
)
|
| 83 |
if "joke" in user_input or "make me happy" in user_input:
|
| 84 |
+
return "π Why don't scientists trust atoms? Because they make up everything!"
|
| 85 |
+
return "Thank you for sharing. I'm here with you. You can keep talking β Iβm listening."
|
|
|
|
| 86 |
|
| 87 |
with gr.Blocks(css="body { background-color: #ffe6f0; }") as app:
|
| 88 |
+
gr.Markdown("## πΈ StrongMind Therapist with Nature Sounds")
|
| 89 |
+
gr.Audio(label="π΅ Calm Nature Music", value="calm_nature.mp3", interactive=False)
|
|
|
|
|
|
|
|
|
|
| 90 |
|
| 91 |
with gr.Tab("π οΈ Start"):
|
| 92 |
name = gr.Textbox(label="Your Name")
|
calm_nature.mp3
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
FAKE_MP3_CONTENT
|