DreamStream-1 commited on
Commit
494ecb7
·
verified ·
1 Parent(s): da85c67

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -159,18 +159,18 @@ def get_health_professionals_and_map(location, query):
159
 
160
  # Main Application Logic
161
  def app_function(user_input, location, query, history):
162
- chatbot_history, _ = generate_chatbot_response(user_input, history) # Generate chatbot response
163
- sentiment_result = analyze_sentiment(user_input) # Sentiment detection
164
- emotion_result, cleaned_emotion = detect_emotion(user_input) # Emotion detection
165
- suggestions = generate_suggestions(cleaned_emotion) # Generate suggestions based on emotion
166
- professionals, map_html = get_health_professionals_and_map(location, query) # Find nearby professionals and map
167
  return chatbot_history, sentiment_result, emotion_result, suggestions, professionals, map_html
168
 
169
- # Gradio Interface
170
  custom_css = """
171
  body {
172
  font-family: 'Roboto', sans-serif;
173
- background: linear-gradient(135deg, #0d0d0d, #ff5722); /* Background gradient */
174
  color: white;
175
  }
176
 
@@ -215,9 +215,9 @@ textarea:hover, input:hover {
215
  border-radius: 10px;
216
  padding: 10px;
217
  font-size: 14px;
218
- max-height: 400px; /* Extends the height of the table */
219
  height: auto;
220
- overflow-y: auto; /* Adds scroll if content overflows */
221
  }
222
  """
223
 
@@ -231,6 +231,10 @@ with gr.Blocks(css=custom_css) as app:
231
  chatbot = gr.Chatbot(label="Chat History")
232
  sentiment = gr.Textbox(label="Detected Sentiment")
233
  emotion = gr.Textbox(label="Detected Emotion")
 
 
 
 
234
  suggestions = gr.DataFrame(headers=["Title", "Link"]) # Table for suggestions
235
  professionals = gr.Textbox(label="Nearby Professionals", lines=6)
236
  map_html = gr.HTML(label="Interactive Map")
 
159
 
160
  # Main Application Logic
161
  def app_function(user_input, location, query, history):
162
+ chatbot_history, _ = generate_chatbot_response(user_input, history)
163
+ sentiment_result = analyze_sentiment(user_input)
164
+ emotion_result, cleaned_emotion = detect_emotion(user_input)
165
+ suggestions = generate_suggestions(cleaned_emotion)
166
+ professionals, map_html = get_health_professionals_and_map(location, query)
167
  return chatbot_history, sentiment_result, emotion_result, suggestions, professionals, map_html
168
 
169
+ # CSS Styling
170
  custom_css = """
171
  body {
172
  font-family: 'Roboto', sans-serif;
173
+ background: linear-gradient(135deg, #0d0d0d, #ff5722);
174
  color: white;
175
  }
176
 
 
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
 
 
231
  chatbot = gr.Chatbot(label="Chat History")
232
  sentiment = gr.Textbox(label="Detected Sentiment")
233
  emotion = gr.Textbox(label="Detected Emotion")
234
+
235
+ # Adding Suggestions Title
236
+ gr.Markdown("### Suggestions", elem_id="suggestions-title")
237
+
238
  suggestions = gr.DataFrame(headers=["Title", "Link"]) # Table for suggestions
239
  professionals = gr.Textbox(label="Nearby Professionals", lines=6)
240
  map_html = gr.HTML(label="Interactive Map")