Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -90,12 +90,15 @@ if location_input and medical_center_query:
|
|
90 |
rating = center.get('rating', 'N/A')
|
91 |
st.write(f"**{name}** - {vicinity} - Rating: {rating}")
|
92 |
|
|
|
|
|
|
|
|
|
93 |
# Add marker for each medical center on map
|
94 |
folium.Marker([center['geometry']['location']['lat'], center['geometry']['location']['lng']],
|
95 |
popup=f"{name}\n{vicinity}\nRating: {rating}").add_to(m2)
|
96 |
|
97 |
# Render the map with medical centers
|
98 |
-
m2 = folium.Map(location=[lat, lon], zoom_start=13)
|
99 |
folium_static(m2)
|
100 |
else:
|
101 |
st.write("No medical centers found matching your query.")
|
|
|
90 |
rating = center.get('rating', 'N/A')
|
91 |
st.write(f"**{name}** - {vicinity} - Rating: {rating}")
|
92 |
|
93 |
+
# Initialize the map object here before adding markers
|
94 |
+
if 'm2' not in locals():
|
95 |
+
m2 = folium.Map(location=[lat, lon], zoom_start=13)
|
96 |
+
|
97 |
# Add marker for each medical center on map
|
98 |
folium.Marker([center['geometry']['location']['lat'], center['geometry']['location']['lng']],
|
99 |
popup=f"{name}\n{vicinity}\nRating: {rating}").add_to(m2)
|
100 |
|
101 |
# Render the map with medical centers
|
|
|
102 |
folium_static(m2)
|
103 |
else:
|
104 |
st.write("No medical centers found matching your query.")
|