DreamStream-1 commited on
Commit
ba98e87
·
verified ·
1 Parent(s): 28af41e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -1
app.py CHANGED
@@ -196,11 +196,22 @@ def provide_suggestions(emotion):
196
  }
197
  return resources.get(emotion, {'message': "Stay calm. 🙂", 'articles': [], 'videos': []})
198
 
 
 
 
 
 
199
  # Function to find wellness professionals
200
  def find_wellness_professionals(location, state):
 
 
 
 
 
 
 
201
  query = "therapist OR counselor OR mental health professional OR marriage and family therapist OR psychotherapist OR psychiatrist OR psychologist in " + location
202
  api_key = "GOOGLE_API_KEY" # Replace with your own API key
203
- location_coords = "21.3,-157.8" # Default to Oahu, Hawaii
204
  radius = 50000 # 50 km radius
205
 
206
  google_places_data = get_all_places(query, location_coords, radius, api_key)
@@ -291,3 +302,4 @@ def gradio_interface():
291
  # Run the Gradio interface
292
  if __name__ == "__main__":
293
  gradio_interface()
 
 
196
  }
197
  return resources.get(emotion, {'message': "Stay calm. 🙂", 'articles': [], 'videos': []})
198
 
199
+ import requests
200
+ import pandas as pd
201
+ import gradio as gr
202
+ import geocoder # Use geocoder to get latitude/longitude from city
203
+
204
  # Function to find wellness professionals
205
  def find_wellness_professionals(location, state):
206
+ # Geocode the location to get latitude and longitude
207
+ g = geocoder.osm(location) # Using OpenStreetMap's geocoding service
208
+ if g.ok:
209
+ location_coords = f"{g.lat},{g.lng}"
210
+ else:
211
+ return "Sorry, could not retrieve coordinates for the location. Please try again.", state
212
+
213
  query = "therapist OR counselor OR mental health professional OR marriage and family therapist OR psychotherapist OR psychiatrist OR psychologist in " + location
214
  api_key = "GOOGLE_API_KEY" # Replace with your own API key
 
215
  radius = 50000 # 50 km radius
216
 
217
  google_places_data = get_all_places(query, location_coords, radius, api_key)
 
302
  # Run the Gradio interface
303
  if __name__ == "__main__":
304
  gradio_interface()
305
+