Bey007 commited on
Commit
30a16a1
·
verified ·
1 Parent(s): e2bfbca

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -8
app.py CHANGED
@@ -46,18 +46,21 @@ def generate_response(user_input):
46
  )
47
  response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
48
 
 
 
 
49
  # Add a suggestion for coping activity based on keywords in user input
50
- if "angry" in user_input.lower() or "frustrated" in user_input.lower():
51
  activity_suggestion = (
52
- "When feeling angry or overwhelmed by work, its important to take a step back. "
53
- "Deep breathing exercises can help calm your mind and regain some control. "
54
- "Try inhaling for four counts, holding for four counts, and exhaling for four counts. "
55
- "Doing this for a few minutes can make a world of difference."
56
  )
57
- elif "sad" in user_input.lower() or "lonely" in user_input.lower():
58
  activity_suggestion = (
59
- "Writing about your feelings can be very therapeutic. Try journaling as a way to process and release some of your emotions. "
60
- "You don’t need to worry about grammar or structure—just let your thoughts flow."
 
61
  )
62
  else:
63
  activity_suggestion = (
 
46
  )
47
  response_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
48
 
49
+ # Trim the output to remove extraneous content
50
+ response_text = response_text.split("Here's something")[0].strip()
51
+
52
  # Add a suggestion for coping activity based on keywords in user input
53
+ if "crying" in user_input.lower() or "overload" in user_input.lower():
54
  activity_suggestion = (
55
+ "Work overload can be overwhelming, and it's completely understandable to feel like you're reaching your limit. "
56
+ "Sometimes, taking a short break can help you gain some clarity and calm your mind. "
57
+ "If possible, try stepping outside for a few minutes to breathe deeply or do some light stretching to release tension."
 
58
  )
59
+ elif "angry" in user_input.lower() or "frustrated" in user_input.lower():
60
  activity_suggestion = (
61
+ "When feeling overwhelmed, anger can sometimes mask deeper emotions like stress or exhaustion. "
62
+ "Taking deep breaths or doing a short meditation can help you ground yourself and regain focus. "
63
+ "Even small moments of calm can make a huge difference."
64
  )
65
  else:
66
  activity_suggestion = (