iamstrong commited on
Commit
a4671fc
·
verified ·
1 Parent(s): a0d34d4

Upload 4 files

Browse files
Files changed (1) hide show
  1. app.py +28 -3
app.py CHANGED
@@ -26,8 +26,10 @@ lang_codes = {
26
  "tamil": "ta", "telugu": "te", "malayalam": "ml", "spanish": "es",
27
  "french": "fr", "german": "de"
28
  }
 
 
29
  emotions = {
30
- "sad": "It's okay to feel sad sometimes 🌧️", "anxiety": "Try breathing slowly 🧘",
31
  "angry": "Take deep breaths. Anger is natural.", "lonely": "I'm here for you 💚",
32
  "exams": "Let’s create a quick plan!", "friend": "Want to talk about them?",
33
  "tired": "You’ve been carrying a lot. Rest isn’t lazy — it’s necessary 😴",
@@ -112,7 +114,7 @@ emotions = {
112
  "invisible": "I see you. You matter.",
113
  "lethargic": "Small movement helps. Try stretching.",
114
  "annoyed": "Want to vent? I’m listening.",
115
- "harm" "cut" "die" "nerves" : "I believe you are very hurt and in that case i may not be able to provide support here are some therapist you might want to talk to""Dr. Meera kapoor - 91+ 9899543877" "Dr. Kunal sharma - 91+ 9953165849" "Remember you are not alone"
116
  "peer pressure": "Your choices are your own. Stand strong.",
117
  "embarrassed": "Everyone messes up sometimes. Let it go.",
118
  "unappreciated": "I appreciate you. Let’s celebrate your efforts.",
@@ -129,7 +131,8 @@ emotions = {
129
  "troubled": "Name the trouble, then tame it. I’m here.",
130
  "underestimated": "You are more than they think. Show them. Gently.",
131
  "burned out": "Burnout needs healing. Step back to move forward."
132
-
 
133
  }
134
 
135
  def set_personal_info(name, age, gender, language):
@@ -142,6 +145,28 @@ def show_personal_data():
142
 
143
  def generate_reply(input_text):
144
  text = input_text.lower()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  for word, reply in emotions.items():
146
  if word in text:
147
  return reply
 
26
  "tamil": "ta", "telugu": "te", "malayalam": "ml", "spanish": "es",
27
  "french": "fr", "german": "de"
28
  }
29
+
30
+ # Emotions dictionary (shortened for display here; your original full list still applies)
31
  emotions = {
32
+ "sad": "It's okay to feel sad sometimes 🌧️", "anxiety": "Try breathing slowly 🧘",
33
  "angry": "Take deep breaths. Anger is natural.", "lonely": "I'm here for you 💚",
34
  "exams": "Let’s create a quick plan!", "friend": "Want to talk about them?",
35
  "tired": "You’ve been carrying a lot. Rest isn’t lazy — it’s necessary 😴",
 
114
  "invisible": "I see you. You matter.",
115
  "lethargic": "Small movement helps. Try stretching.",
116
  "annoyed": "Want to vent? I’m listening.",
117
+ "fomo": "It’s okay not to do everything. Your pace is right.",
118
  "peer pressure": "Your choices are your own. Stand strong.",
119
  "embarrassed": "Everyone messes up sometimes. Let it go.",
120
  "unappreciated": "I appreciate you. Let’s celebrate your efforts.",
 
131
  "troubled": "Name the trouble, then tame it. I’m here.",
132
  "underestimated": "You are more than they think. Show them. Gently.",
133
  "burned out": "Burnout needs healing. Step back to move forward."
134
+
135
+
136
  }
137
 
138
  def set_personal_info(name, age, gender, language):
 
145
 
146
  def generate_reply(input_text):
147
  text = input_text.lower()
148
+
149
+ crisis_words = {
150
+ "harm", "cut", "die", "kill", "suicide", "end it", "hurt myself",
151
+ "self-harm", "jump", "knife", "bleed", "worth ending", "give up",
152
+ "no reason", "nothing matters", "nerves", "overdose"
153
+ }
154
+
155
+ if any(word in text for word in crisis_words):
156
+ return (
157
+ "⚠️ It sounds like you're going through a really tough time.\n\n"
158
+ "Please reach out to a professional:\n\n"
159
+ "🇮🇳 **India Helplines**\n"
160
+ "🧠 *Dr. Rachna Khanna Singh* – +91 99103 90559\n"
161
+ "📞 *iCall Helpline* – +91 9152987821\n"
162
+ "📞 *Vandrevala Foundation* – 1860 266 2345 or 1800 233 3330\n\n"
163
+ "🌍 **International Helplines**\n"
164
+ "📞 *Lifeline (USA)* – 988\n"
165
+ "📞 *Samaritans (UK)* – 116 123\n"
166
+ "📞 *Lifeline (Australia)* – 13 11 14\n\n"
167
+ "You are not alone. There are people who care and want to help 💚"
168
+ )
169
+
170
  for word, reply in emotions.items():
171
  if word in text:
172
  return reply