Spaces:
Sleeping
Sleeping
Meet Radadiya commited on
Commit ยท
65d4dac
1
Parent(s): 5c1c4fc
Fix: remove Google Maps iframe embed, use link button instead (HF CSP fix)
Browse files
frontend/components/hospital_map.py
CHANGED
|
@@ -5,44 +5,26 @@ import streamlit as st
|
|
| 5 |
|
| 6 |
|
| 7 |
def render_hospital_map(result, selected_city, selected_state):
|
| 8 |
-
"""
|
| 9 |
-
Render the hospital finder with embedded Google Maps
|
| 10 |
-
|
| 11 |
-
Args:
|
| 12 |
-
result: Dictionary containing prediction results
|
| 13 |
-
selected_city: Selected city name
|
| 14 |
-
selected_state: Selected state name
|
| 15 |
-
"""
|
| 16 |
hosp_type = result.get("hospital_type", "Dermatologist")
|
| 17 |
location = result.get("hospital_location", f"{selected_city}, {selected_state}")
|
| 18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
st.markdown(
|
| 20 |
f'<div class="pro-card">'
|
| 21 |
f"<h3>๐ฅ Find {hosp_type}</h3>"
|
| 22 |
f"<p>๐ Searching in: <strong>{location}</strong></p>"
|
|
|
|
| 23 |
f"</div>",
|
| 24 |
unsafe_allow_html=True,
|
| 25 |
)
|
| 26 |
|
| 27 |
-
search_query = result.get("hospital_search_query", "dermatologist near me")
|
| 28 |
-
full_query = f"{search_query} in {selected_city}, {selected_state}, India"
|
| 29 |
-
maps_url = "https://www.google.com/maps/search/" + full_query.replace(" ", "+")
|
| 30 |
-
|
| 31 |
-
# Embed Google Maps
|
| 32 |
-
maps_embed_url = f"https://www.google.com/maps/embed/v1/search?key=AIzaSyBFw0Qbyq9zTFTd-tUY6dZWTgaQzuU17R8&q={full_query.replace(' ', '+')}"
|
| 33 |
-
|
| 34 |
-
st.markdown(
|
| 35 |
-
f'<div class="map-container">'
|
| 36 |
-
f'<iframe width="100%" height="450" style="border:0;" '
|
| 37 |
-
f'src="{maps_embed_url}" allowfullscreen loading="lazy"></iframe>'
|
| 38 |
-
f'</div>',
|
| 39 |
-
unsafe_allow_html=True,
|
| 40 |
-
)
|
| 41 |
-
|
| 42 |
st.link_button(
|
| 43 |
-
f"๐บ๏ธ Open
|
| 44 |
maps_url,
|
| 45 |
-
|
| 46 |
)
|
| 47 |
|
| 48 |
st.markdown("")
|
|
|
|
| 5 |
|
| 6 |
|
| 7 |
def render_hospital_map(result, selected_city, selected_state):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
hosp_type = result.get("hospital_type", "Dermatologist")
|
| 9 |
location = result.get("hospital_location", f"{selected_city}, {selected_state}")
|
| 10 |
|
| 11 |
+
search_query = result.get("hospital_search_query", "dermatologist near me")
|
| 12 |
+
full_query = f"{search_query} in {selected_city}, {selected_state}, India"
|
| 13 |
+
maps_url = "https://www.google.com/maps/search/" + full_query.replace(" ", "+")
|
| 14 |
+
|
| 15 |
st.markdown(
|
| 16 |
f'<div class="pro-card">'
|
| 17 |
f"<h3>๐ฅ Find {hosp_type}</h3>"
|
| 18 |
f"<p>๐ Searching in: <strong>{location}</strong></p>"
|
| 19 |
+
f'<p style="color:#94a3b8;font-size:0.9rem;">Click the button below to find nearby specialists on Google Maps.</p>'
|
| 20 |
f"</div>",
|
| 21 |
unsafe_allow_html=True,
|
| 22 |
)
|
| 23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
st.link_button(
|
| 25 |
+
f"๐บ๏ธ Open Google Maps โ {hosp_type}",
|
| 26 |
maps_url,
|
| 27 |
+
use_container_width=True,
|
| 28 |
)
|
| 29 |
|
| 30 |
st.markdown("")
|