DreamStream-1 commited on
Commit
c2adf9a
·
verified ·
1 Parent(s): fc18b37

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +66 -42
app.py CHANGED
@@ -173,61 +173,85 @@ body {
173
  background: linear-gradient(135deg, #0d0d0d, #ff5722);
174
  color: white;
175
  }
 
176
  h1 {
177
- text-align: center;
178
- color: white;
179
- font-size: 36px;
 
180
  font-weight: bold;
 
 
181
  }
182
- textarea {
183
- width: 100%;
184
- height: 150px;
185
- background-color: #333333;
186
- color: white;
187
- border: 1px solid #ff5722;
188
- border-radius: 5px;
189
- font-size: 16px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
190
  padding: 10px;
 
 
 
 
191
  }
192
- button {
193
- background-color: #ff5722;
 
 
194
  color: white;
195
- font-size: 16px;
196
- padding: 10px 20px;
197
- border-radius: 5px;
198
- border: none;
199
- cursor: pointer;
200
- }
201
- button:hover {
202
- background-color: #e64a19;
203
  }
204
  """
205
 
206
- # Gradio Interface Setup
207
  with gr.Blocks(css=custom_css) as app:
208
- gr.Markdown("# 🌟 Mental Health Chatbot App")
209
  with gr.Row():
210
- chatbot_output = gr.Chatbot(label="Chat History", elem_id="chatbox")
211
- user_input = gr.Textbox(label="Your Message", placeholder="Type something...", interactive=True)
212
-
213
- gr.Markdown("### Sentiment, Emotion, and Suggestions")
214
- sentiment_output = gr.Textbox(label="Sentiment Analysis")
215
- emotion_output = gr.Textbox(label="Emotion Detected")
216
- suggestions_output = gr.DataFrame(headers=["Title", "Link"], label="Suggestions")
217
 
218
- gr.Markdown("### Locate Health Professionals (Optional)")
219
- location_input = gr.Textbox(label="Your Location")
220
- query_input = gr.Textbox(label="Query (e.g., therapist, clinic)", placeholder="Type something...", interactive=True)
221
 
222
- professionals_output = gr.DataFrame(headers=["Professional", "Address"], label="Nearby Professionals")
223
- map_output = gr.HTML(label="Map of Professionals")
224
-
225
- submit_button = gr.Button(value="Submit", elem_id="submit-btn")
226
- submit_button.click(
 
227
  app_function,
228
- inputs=[user_input, location_input, query_input, chatbot_output],
229
- outputs=[chatbot_output, sentiment_output, emotion_output, suggestions_output, professionals_output, map_output]
230
  )
231
 
232
- # Run the App
233
- app.launch(share=True)
 
173
  background: linear-gradient(135deg, #0d0d0d, #ff5722);
174
  color: white;
175
  }
176
+
177
  h1 {
178
+ background: #ffffff;
179
+ color: #000000;
180
+ border-radius: 8px;
181
+ padding: 10px;
182
  font-weight: bold;
183
+ text-align: center;
184
+ font-size: 2.5rem;
185
  }
186
+
187
+ textarea, input {
188
+ background: transparent;
189
+ color: black;
190
+ border: 2px solid orange;
191
+ padding: 8px;
192
+ font-size: 1rem;
193
+ caret-color: black;
194
+ outline: none;
195
+ border-radius: 8px;
196
+ }
197
+
198
+ textarea:focus, input:focus {
199
+ background: transparent;
200
+ color: black;
201
+ border: 2px solid orange;
202
+ outline: none;
203
+ }
204
+
205
+ textarea:hover, input:hover {
206
+ background: transparent;
207
+ color: black;
208
+ border: 2px solid orange;
209
+ }
210
+
211
+ .df-container {
212
+ background: white;
213
+ color: black;
214
+ border: 2px solid orange;
215
+ border-radius: 10px;
216
  padding: 10px;
217
+ font-size: 14px;
218
+ max-height: 400px;
219
+ height: auto;
220
+ overflow-y: auto;
221
  }
222
+
223
+ #suggestions-title {
224
+ text-align: center;
225
+ font-weight: bold;
226
  color: white;
227
+ font-size: 1.8rem;
228
+ margin-bottom: 20px;
 
 
 
 
 
 
229
  }
230
  """
231
 
232
+ # Gradio Application
233
  with gr.Blocks(css=custom_css) as app:
234
+ gr.HTML("<h1>🌟 Well-Being Companion</h1>")
235
  with gr.Row():
236
+ user_input = gr.Textbox(label="Your Message")
237
+ location = gr.Textbox(label="Your Location")
238
+ query = gr.Textbox(label="Search Query")
239
+ chatbot = gr.Chatbot(label="Chat History")
240
+ sentiment = gr.Textbox(label="Detected Sentiment")
241
+ emotion = gr.Textbox(label="Detected Emotion")
 
242
 
243
+ # Adding Suggestions Title with Styled Markdown (Centered and Bold)
244
+ gr.Markdown("Suggestions", elem_id="suggestions-title")
 
245
 
246
+ suggestions = gr.DataFrame(headers=["Title", "Link"]) # Table for suggestions
247
+ professionals = gr.Textbox(label="Nearby Professionals", lines=6)
248
+ map_html = gr.HTML(label="Interactive Map")
249
+ submit = gr.Button(value="Submit", variant="primary")
250
+
251
+ submit.click(
252
  app_function,
253
+ inputs=[user_input, location, query, chatbot],
254
+ outputs=[chatbot, sentiment, emotion, suggestions, professionals, map_html],
255
  )
256
 
257
+ app.launch()