DreamStream-1 commited on
Commit
a41d07f
·
verified ·
1 Parent(s): c69efb6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -4
app.py CHANGED
@@ -86,7 +86,7 @@ def chat(message, history):
86
  response = random.choice(responses)
87
  break
88
  else:
89
- response = "I'm sorry, I didn't understand that. Could be could you please rephrase?"
90
 
91
  except Exception as e:
92
  response = f"An error occurred: {str(e)}"
@@ -132,7 +132,7 @@ def get_place_details(place_id, api_key):
132
  return response.json()
133
 
134
  def fetch_nearby_health_professionals(location):
135
- api_key = "GOOGLE_API_KEY" # Replace with your actual Google API key
136
  query = "therapist OR counselor OR mental health professional OR marriage and family therapist OR psychotherapist OR psychiatrist OR psychologist OR nutritionist OR wellness doctor OR holistic practitioner OR integrative medicine OR chiropractor OR naturopath"
137
  radius = 50000 # 50 km radius
138
 
@@ -165,7 +165,8 @@ with gr.Blocks() as demo:
165
 
166
  # Model prediction for emotion detection
167
  def predict_emotion(text):
168
- return predict_emotion(text)
 
169
 
170
  # Show suggestions based on the detected emotion
171
  def show_suggestions(emotion):
@@ -241,7 +242,8 @@ with gr.Blocks() as demo:
241
 
242
  # Prediction button for sentiment analysis
243
  def predict_sentiment(text):
244
- return predict_sentiment(text)
 
245
 
246
  sentiment_output = gr.Textbox(label="Predicted Sentiment")
247
  submit_sentiment.click(predict_sentiment, inputs=user_input_sentiment, outputs=sentiment_output)
 
86
  response = random.choice(responses)
87
  break
88
  else:
89
+ response = "I'm sorry, I didn't understand that. Could you please rephrase?"
90
 
91
  except Exception as e:
92
  response = f"An error occurred: {str(e)}"
 
132
  return response.json()
133
 
134
  def fetch_nearby_health_professionals(location):
135
+ api_key = "YOUR_GOOGLE_API_KEY" # Replace with your actual Google API key
136
  query = "therapist OR counselor OR mental health professional OR marriage and family therapist OR psychotherapist OR psychiatrist OR psychologist OR nutritionist OR wellness doctor OR holistic practitioner OR integrative medicine OR chiropractor OR naturopath"
137
  radius = 50000 # 50 km radius
138
 
 
165
 
166
  # Model prediction for emotion detection
167
  def predict_emotion(text):
168
+ result = emotion_pipeline(text)
169
+ return result[0]['label']
170
 
171
  # Show suggestions based on the detected emotion
172
  def show_suggestions(emotion):
 
242
 
243
  # Prediction button for sentiment analysis
244
  def predict_sentiment(text):
245
+ result = sentiment_pipeline(text)
246
+ return result[0]['label']
247
 
248
  sentiment_output = gr.Textbox(label="Predicted Sentiment")
249
  submit_sentiment.click(predict_sentiment, inputs=user_input_sentiment, outputs=sentiment_output)