raviix46 commited on
Commit
74ebf0b
·
verified ·
1 Parent(s): 3f3671e

Update tabs/therapy_chat.py

Browse files
Files changed (1) hide show
  1. tabs/therapy_chat.py +108 -101
tabs/therapy_chat.py CHANGED
@@ -26,119 +26,126 @@ def clear_chat():
26
  chat_history = []
27
  return "", ""
28
 
 
29
  # UI function
30
  def therapy_chat_tab():
31
  gr.Markdown("## 🧠 TherapyBot++", elem_classes="centered-text")
32
- gr.Markdown("Thoughtfully designed to be your safe and supportive space — here for you when your mind needs it the most.", elem_classes="centered-text")
33
- with gr.Row():
34
- with gr.Column():
35
- user_input = gr.Textbox(placeholder="How are you feeling?", label="🗣 Your Message", lines=8)
36
- submit_btn = gr.Button("Submit", elem_id="submit-btn")
37
- clear_btn = gr.Button("Clear")
38
- with gr.Column():
39
- with gr.Accordion("📜 Chat History", open=True):
40
- chat_display = gr.Textbox(label=None, interactive=False, lines=13.8, container=False)
41
- submit_btn.click(respond, user_input, outputs=[user_input, chat_display])
42
- clear_btn.click(clear_chat, outputs=[user_input, chat_display])
43
- gr.Markdown(
44
- """
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  <div style="
46
- height: auto;
47
- min-height: 100px;
48
- width: 100%;
49
- max-width: 65%;
50
- margin: 15px auto;
51
- overflow: hidden;
52
- position: relative;
53
- background: linear-gradient(to right, #1c2f3a 0%, #000000 50%, #1c2f3a 100%);
54
- border-radius: 12px;
55
- box-shadow: 0 2px 12px rgba(0,0,0,0.4);
56
- text-align: center;
57
- padding: 16px 24px;
58
- box-sizing: border-box;
59
  ">
60
- <div style="
61
- font-size: 15px;
62
- color: #e0e0e0;
63
- font-weight: 600;
64
- margin-bottom: 14px;
65
- position: relative;
66
- z-index: 2;
67
- ">
68
- 🧠 <em>Here are some surprising and helpful wellness facts:</em>
69
- </div>
70
- <div class="scroll-wrapper chatbot-scroll">
71
- <div class="scroll-content chatbot-content">
72
- <div class="scroll-inner">
73
- <div>-----</div>
74
- <div>🧠 Talking to someone about your emotions can significantly lower stress levels.</div>
75
- <div>👃 The average human nose can identify over 50,000 different smells.</div>
76
- <div>😶‍🌫️ Suppressing emotions doesn’t erase them they return stronger later.</div>
77
- <div>🧠 Your brain remains plastic at any age emotional healing is always possible.</div>
78
- <div>🍋 Lemons are among the healthiest fruits, rich in antioxidants and immune support.</div>
79
- <div>🛏️ Sleep affects nearly every system in the body — it’s your natural mental reset.</div>
80
- <div>🔁 Replaying negative thoughts rewires your brain for anxiety called cognitive looping.</div>
81
- <div>🍵 Drinking a warm beverage may help your body feel cooler and more relaxed.</div>
82
- <div>👶 Newborns have the fastest heartbeats of any human age group.</div>
83
- <div>🦶 Your feet can reveal early signs of deeper health issues like diabetes or stress.</div>
84
- <div>👫 Companionship and bonding are great for both your heart and brain health.</div>
85
- <div>👂 The brain releases calming chemicals when it feels truly listened to.</div>
86
- <div>🌞 Optimistic thinking can add years to your life by reducing stress.</div>
87
- <div>❄️ Cold weather can boost metabolism and strengthen your immune system.</div>
88
- <div>👁️ You can physically see signs of high cholesterol in your eyes and skin.</div>
89
- <div>🎨 Creative activities like drawing or music reduce anxiety and boost cognition.</div>
90
- <div>🧬 Trauma can be inherited emotions may echo generations before you.</div>
91
- <div>😢 Humans are the only animals who cry due to emotional reasons.</div>
92
- <div>📵 Limiting screen time improves focus, clarity, and emotional regulation.</div>
93
- <div>💓 Your heart beats over 100,000 times a day to keep you alive and well.</div>
94
- <div>☕ Drinking coffee may reduce symptoms of depression and lift your mood.</div>
95
- <div>💧 You can lose 3% body weight in fluids before even feeling thirsty.</div>
96
- <div>📆 Heart attacks are most frequent on Monday mornings due to work stress.</div>
97
- <div>🐶 A dog’s companionship may lower blood pressure and protect your heart.</div>
98
- <div>🩸 The heart pumps nearly 2,000 gallons of blood every day.</div>
99
- <div>😣 Chronic stress increases your risk of type 2 diabetes.</div>
100
- <div>🩻 Some capillaries are ten times thinner than a strand of hair.</div>
101
- <div>🦴 More than half your bones are located in your hands and feet.</div>
102
- <div>🧘 Just 10 minutes of mindful breathing can reset your brain chemistry.</div>
103
- <div>❓ Most therapy breakthroughs come from better questions — not quick answers.</div>
104
- <div>😂 Laughter releases feel-good hormones and even helps reduce pain.</div>
105
- <div>🫀 Your heart weighs around 7 to 15 ounces depending on your body.</div>
106
- <div>🏃 The heart works harder than a sprinter's leg muscles — nonstop effort.</div>
107
- <div>🧠 Emotional pain activates the same brain region as physical pain.</div>
108
- <div>🍌 Bananas can naturally boost your mood by increasing serotonin levels.</div>
109
- </div>
110
  </div>
111
  </div>
112
  </div>
113
- <style>
 
114
  .chatbot-scroll .chatbot-content {
115
- position: absolute;
116
- width: 100%;
117
- animation: chatbot-scroll-vertical 130s linear infinite;
118
- will-change: transform;
119
  }
120
  .scroll-wrapper {
121
- height: 50px;
122
- overflow: hidden;
123
- position: relative;
124
- }
125
  .scroll-inner {
126
- display: flex;
127
- flex-direction: column;
128
- gap: 20px;
129
- color: #bbbbbb;
130
- font-size: 13.8px;
131
- line-height: 1.5;
132
  }
133
  @keyframes chatbot-scroll-vertical {
134
- 0% {
135
- transform: translateY(0);
136
- }
137
- 100% {
138
- transform: translateY(-50%);
139
- }
140
  }
141
- </style>
142
- """,
143
- elem_classes="centered-text"
144
- )
 
26
  chat_history = []
27
  return "", ""
28
 
29
+ # UI function
30
  # UI function
31
  def therapy_chat_tab():
32
  gr.Markdown("## 🧠 TherapyBot++", elem_classes="centered-text")
33
+ gr.Markdown(
34
+ "Thoughtfully designed to be your safe and supportive space — here for you when your mind needs it the most.",
35
+ elem_classes="centered-text"
36
+ )
37
+
38
+ with gr.Row():
39
+ with gr.Column():
40
+ user_input = gr.Textbox(placeholder="How are you feeling?", label="🗣 Your Message", lines=8)
41
+ submit_btn = gr.Button("Submit", elem_id="submit-btn")
42
+ clear_btn = gr.Button("Clear")
43
+ with gr.Column():
44
+ with gr.Accordion("📜 Chat History", open=True):
45
+ chat_display = gr.Textbox(label=None, interactive=False, lines=13.8, container=False)
46
+
47
+ submit_btn.click(respond, user_input, outputs=[user_input, chat_display])
48
+ clear_btn.click(clear_chat, outputs=[user_input, chat_display])
49
+
50
+ gr.Markdown(
51
+ """
52
+ <div style="
53
+ height: auto;
54
+ min-height: 100px;
55
+ width: 100%;
56
+ max-width: 65%;
57
+ margin: 15px auto;
58
+ overflow: hidden;
59
+ position: relative;
60
+ background: linear-gradient(to right, #1c2f3a 0%, #000000 50%, #1c2f3a 100%);
61
+ border-radius: 12px;
62
+ box-shadow: 0 2px 12px rgba(0,0,0,0.4);
63
+ text-align: center;
64
+ padding: 16px 24px;
65
+ box-sizing: border-box;
66
+ ">
67
  <div style="
68
+ font-size: 15px;
69
+ color: #e0e0e0;
70
+ font-weight: 600;
71
+ margin-bottom: 14px;
72
+ position: relative;
73
+ z-index: 2;
 
 
 
 
 
 
 
74
  ">
75
+ 🧠 <em>Here are some surprising and helpful wellness facts:</em>
76
+ </div>
77
+ <div class="scroll-wrapper chatbot-scroll">
78
+ <div class="scroll-content chatbot-content">
79
+ <div class="scroll-inner">
80
+ <div>-----</div>
81
+ <div>🧠 Talking to someone about your emotions can significantly lower stress levels.</div>
82
+ <div>👃 The average human nose can identify over 50,000 different smells.</div>
83
+ <div>😶‍🌫️ Suppressing emotions doesn’t erase them they return stronger later.</div>
84
+ <div>🧠 Your brain remains plastic at any age — emotional healing is always possible.</div>
85
+ <div>🍋 Lemons are among the healthiest fruits, rich in antioxidants and immune support.</div>
86
+ <div>🛏️ Sleep affects nearly every system in the body — it’s your natural mental reset.</div>
87
+ <div>🔁 Replaying negative thoughts rewires your brain for anxiety — called cognitive looping.</div>
88
+ <div>🍵 Drinking a warm beverage may help your body feel cooler and more relaxed.</div>
89
+ <div>👶 Newborns have the fastest heartbeats of any human age group.</div>
90
+ <div>🦶 Your feet can reveal early signs of deeper health issues like diabetes or stress.</div>
91
+ <div>👫 Companionship and bonding are great for both your heart and brain health.</div>
92
+ <div>👂 The brain releases calming chemicals when it feels truly listened to.</div>
93
+ <div>🌞 Optimistic thinking can add years to your life by reducing stress.</div>
94
+ <div>❄️ Cold weather can boost metabolism and strengthen your immune system.</div>
95
+ <div>👁️ You can physically see signs of high cholesterol in your eyes and skin.</div>
96
+ <div>🎨 Creative activities like drawing or music reduce anxiety and boost cognition.</div>
97
+ <div>🧬 Trauma can be inherited emotions may echo generations before you.</div>
98
+ <div>😢 Humans are the only animals who cry due to emotional reasons.</div>
99
+ <div>📵 Limiting screen time improves focus, clarity, and emotional regulation.</div>
100
+ <div>💓 Your heart beats over 100,000 times a day to keep you alive and well.</div>
101
+ <div>☕ Drinking coffee may reduce symptoms of depression and lift your mood.</div>
102
+ <div>💧 You can lose 3% body weight in fluids before even feeling thirsty.</div>
103
+ <div>📆 Heart attacks are most frequent on Monday mornings due to work stress.</div>
104
+ <div>🐶 A dog’s companionship may lower blood pressure and protect your heart.</div>
105
+ <div>🩸 The heart pumps nearly 2,000 gallons of blood every day.</div>
106
+ <div>😣 Chronic stress increases your risk of type 2 diabetes.</div>
107
+ <div>🩻 Some capillaries are ten times thinner than a strand of hair.</div>
108
+ <div>🦴 More than half your bones are located in your hands and feet.</div>
109
+ <div>🧘 Just 10 minutes of mindful breathing can reset your brain chemistry.</div>
110
+ <div>❓ Most therapy breakthroughs come from better questions not quick answers.</div>
111
+ <div>😂 Laughter releases feel-good hormones and even helps reduce pain.</div>
112
+ <div>🫀 Your heart weighs around 7 to 15 ounces depending on your body.</div>
113
+ <div>🏃 The heart works harder than a sprinter's leg muscles — nonstop effort.</div>
114
+ <div>🧠 Emotional pain activates the same brain region as physical pain.</div>
115
+ <div>🍌 Bananas can naturally boost your mood by increasing serotonin levels.</div>
 
 
 
 
 
 
 
 
 
116
  </div>
117
  </div>
118
  </div>
119
+ </div>
120
+ <style>
121
  .chatbot-scroll .chatbot-content {
122
+ position: absolute;
123
+ width: 100%;
124
+ animation: chatbot-scroll-vertical 130s linear infinite;
125
+ will-change: transform;
126
  }
127
  .scroll-wrapper {
128
+ height: 50px;
129
+ overflow: hidden;
130
+ position: relative;
131
+ }
132
  .scroll-inner {
133
+ display: flex;
134
+ flex-direction: column;
135
+ gap: 20px;
136
+ color: #bbbbbb;
137
+ font-size: 13.8px;
138
+ line-height: 1.5;
139
  }
140
  @keyframes chatbot-scroll-vertical {
141
+ 0% {
142
+ transform: translateY(0);
143
+ }
144
+ 100% {
145
+ transform: translateY(-50%);
146
+ }
147
  }
148
+ </style>
149
+ """,
150
+ elem_classes="centered-text"
151
+ )