Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,7 +26,6 @@ def render_folium_map(coords):
|
|
26 |
|
27 |
# Function to search nearby medical centers using Google Places API
|
28 |
def search_medical_centers(query, location, radius=10000):
|
29 |
-
# Search for places like hospitals or medical centers nearby
|
30 |
places_result = gmaps.places_nearby(location, radius=radius, type='hospital', keyword=query)
|
31 |
return places_result.get('results', [])
|
32 |
|
@@ -51,13 +50,11 @@ def get_route_and_medical_centers(current_location, destination_location, health
|
|
51 |
# Fetch nearby medical centers if the location input is provided
|
52 |
if current_location and health_professional_query:
|
53 |
try:
|
54 |
-
# Fetch the coordinates of the current location using Google Geocoding
|
55 |
geocode_result = gmaps.geocode(current_location)
|
56 |
if geocode_result:
|
57 |
location_coords = geocode_result[0]['geometry']['location']
|
58 |
lat, lon = location_coords['lat'], location_coords['lng']
|
59 |
|
60 |
-
# Fetch nearby medical centers based on the query
|
61 |
medical_centers = search_medical_centers(health_professional_query, (lat, lon))
|
62 |
|
63 |
if medical_centers:
|
@@ -86,13 +83,10 @@ health_professional_query_input = gr.Textbox(value="Hawaii Medical Center", labe
|
|
86 |
route_info_output = gr.Textbox(label="Driving Directions")
|
87 |
map_output = gr.HTML(label="Map with Route and Health Professionals")
|
88 |
|
89 |
-
# Submit button
|
90 |
-
submit_button = gr.Button("Submit")
|
91 |
-
|
92 |
# Create Gradio interface
|
93 |
iface = gr.Interface(
|
94 |
fn=get_route_and_medical_centers, # Function to call
|
95 |
-
inputs=[current_location_input, destination_location_input, health_professional_query_input
|
96 |
outputs=[route_info_output, map_output], # Outputs
|
97 |
live=False # Disable live updates, use button click to trigger the function
|
98 |
)
|
|
|
26 |
|
27 |
# Function to search nearby medical centers using Google Places API
|
28 |
def search_medical_centers(query, location, radius=10000):
|
|
|
29 |
places_result = gmaps.places_nearby(location, radius=radius, type='hospital', keyword=query)
|
30 |
return places_result.get('results', [])
|
31 |
|
|
|
50 |
# Fetch nearby medical centers if the location input is provided
|
51 |
if current_location and health_professional_query:
|
52 |
try:
|
|
|
53 |
geocode_result = gmaps.geocode(current_location)
|
54 |
if geocode_result:
|
55 |
location_coords = geocode_result[0]['geometry']['location']
|
56 |
lat, lon = location_coords['lat'], location_coords['lng']
|
57 |
|
|
|
58 |
medical_centers = search_medical_centers(health_professional_query, (lat, lon))
|
59 |
|
60 |
if medical_centers:
|
|
|
83 |
route_info_output = gr.Textbox(label="Driving Directions")
|
84 |
map_output = gr.HTML(label="Map with Route and Health Professionals")
|
85 |
|
|
|
|
|
|
|
86 |
# Create Gradio interface
|
87 |
iface = gr.Interface(
|
88 |
fn=get_route_and_medical_centers, # Function to call
|
89 |
+
inputs=[current_location_input, destination_location_input, health_professional_query_input], # Inputs
|
90 |
outputs=[route_info_output, map_output], # Outputs
|
91 |
live=False # Disable live updates, use button click to trigger the function
|
92 |
)
|