Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -146,14 +146,17 @@ def get_health_professionals_and_map(location, query):
|
|
146 |
professionals = []
|
147 |
map_ = folium.Map(location=(lat, lng), zoom_start=13)
|
148 |
for place in places_result:
|
149 |
-
professionals.append(
|
|
|
|
|
|
|
150 |
folium.Marker(
|
151 |
location=[place["geometry"]["location"]["lat"], place["geometry"]["location"]["lng"]],
|
152 |
popup=f"{place['name']}"
|
153 |
).add_to(map_)
|
154 |
return professionals, map_._repr_html_()
|
155 |
|
156 |
-
return ["
|
157 |
except Exception as e:
|
158 |
return [f"An error occurred: {e}"], ""
|
159 |
|
@@ -170,7 +173,7 @@ def app_function(user_input, location, query, history):
|
|
170 |
custom_css = """
|
171 |
body {
|
172 |
font-family: 'Roboto', sans-serif;
|
173 |
-
background:
|
174 |
color: white;
|
175 |
}
|
176 |
|
@@ -251,6 +254,9 @@ with gr.Blocks(css=custom_css) as app:
|
|
251 |
user_input = gr.Textbox(label="Please Enter Your Message Here")
|
252 |
location = gr.Textbox(label="Please Enter Your Current Location Here")
|
253 |
query = gr.Textbox(label="Please Enter Which Health Professional You Want To Search Nearby")
|
|
|
|
|
|
|
254 |
chatbot = gr.Chatbot(label="Chat History")
|
255 |
sentiment = gr.Textbox(label="Detected Sentiment")
|
256 |
emotion = gr.Textbox(label="Detected Emotion")
|
@@ -259,9 +265,8 @@ with gr.Blocks(css=custom_css) as app:
|
|
259 |
gr.Markdown("Suggestions", elem_id="suggestions-title")
|
260 |
|
261 |
suggestions = gr.DataFrame(headers=["Title", "Link"]) # Table for suggestions
|
262 |
-
professionals = gr.
|
263 |
map_html = gr.HTML(label="Interactive Map")
|
264 |
-
submit = gr.Button(value="Submit", variant="primary")
|
265 |
|
266 |
submit.click(
|
267 |
app_function,
|
|
|
146 |
professionals = []
|
147 |
map_ = folium.Map(location=(lat, lng), zoom_start=13)
|
148 |
for place in places_result:
|
149 |
+
professionals.append({
|
150 |
+
"Name": place['name'],
|
151 |
+
"Address": place.get('vicinity', 'No address provided')
|
152 |
+
})
|
153 |
folium.Marker(
|
154 |
location=[place["geometry"]["location"]["lat"], place["geometry"]["location"]["lng"]],
|
155 |
popup=f"{place['name']}"
|
156 |
).add_to(map_)
|
157 |
return professionals, map_._repr_html_()
|
158 |
|
159 |
+
return [], "" # Return empty list if no professionals found
|
160 |
except Exception as e:
|
161 |
return [f"An error occurred: {e}"], ""
|
162 |
|
|
|
173 |
custom_css = """
|
174 |
body {
|
175 |
font-family: 'Roboto', sans-serif;
|
176 |
+
background-color: #3c6487; /* Set the background color */
|
177 |
color: white;
|
178 |
}
|
179 |
|
|
|
254 |
user_input = gr.Textbox(label="Please Enter Your Message Here")
|
255 |
location = gr.Textbox(label="Please Enter Your Current Location Here")
|
256 |
query = gr.Textbox(label="Please Enter Which Health Professional You Want To Search Nearby")
|
257 |
+
|
258 |
+
submit = gr.Button(value="Submit", variant="primary")
|
259 |
+
|
260 |
chatbot = gr.Chatbot(label="Chat History")
|
261 |
sentiment = gr.Textbox(label="Detected Sentiment")
|
262 |
emotion = gr.Textbox(label="Detected Emotion")
|
|
|
265 |
gr.Markdown("Suggestions", elem_id="suggestions-title")
|
266 |
|
267 |
suggestions = gr.DataFrame(headers=["Title", "Link"]) # Table for suggestions
|
268 |
+
professionals = gr.DataFrame(label="Nearby Health Professionals", headers=["Name", "Address"]) # Change to DataFrame for professionals
|
269 |
map_html = gr.HTML(label="Interactive Map")
|
|
|
270 |
|
271 |
submit.click(
|
272 |
app_function,
|