Spaces:
Sleeping
Sleeping
Meet Radadiya commited on
Commit Β·
312f467
1
Parent(s): 65d4dac
Use MAPS_API_KEY env secret for Google Maps embed
Browse files1234563 unmodified lines10111213141516171819202122232425269 unmodified lines363738"""Hospital Map Component for DermaScan AI"""import streamlit as st3 unmodified linessearch_query = result.get("hospital_search_query", "dermatologist near me")full_query = f"{search_query} in {selected_city}, {selected_state}, India"maps_url = "https://www.google.com/maps/search/" + full_query.replace(" ", "+")st.markdown(f'<div class="pro-card">'f"<h3>π₯ Find {hosp_type}</h3>"f"<p>π Searching in: <strong>{location}</strong></p>"f'<p style="color:#94a3b8;font-size:0.9rem;">Click the button below to find nearby specialists on Google Maps.</p>'f"</div>",unsafe_allow_html=True,)st.link_button(f"πΊοΈ Open Google Maps β {hosp_type}",maps_url,9 unmodified linesemer_html += f"<p>π {label}: <b>{num}</b></p>"emer_html += "</div>"st.markdown(emer_html, unsafe_allow_html=True)12345673 unmodified lines111213141516171819202122232425262728293031323334353637389 unmodified lines48495051525354555657585960"""Hospital Map Component for DermaScan AI"""import osimport streamlit as st3 unmodified linessearch_query = result.get("hospital_search_query", "dermatologist near me")full_query = f"{search_query} in {selected_city}, {selected_state}, India"encoded_query = full_query.replace(" ", "+")maps_url = "https://www.google.com/maps/search/" + encoded_queryst.markdown(f'<div class="pro-card">'f"<h3>π₯ Find {hosp_type}</h3>"f"<p>π Searching in: <strong>{location}</strong></p>"f"</div>",unsafe_allow_html=True,)api_key = os.environ.get("MAPS_API_KEY", "")if api_key:embed_url = f"https://www.google.com/maps/embed/v1/search?key={api_key}&q={encoded_query}"st.markdown(f'<iframe width="100%" height="450" style="border:0;border-radius:12px;" 'f'src="{embed_url}" allowfullscreen loading="lazy"></iframe>',unsafe_allow_html=True,)else:st.info("Set the MAPS_API_KEY secret in HF Space settings to enable the embedded map.")st.link_button(f"πΊοΈ Open Google Maps β {hosp_type}",maps_url,9 unmodified linesemer_html += f"<p>π {label}: <b>{num}</b></p>"emer_html += "</div>"st.markdown(emer_html, unsafe_allow_html=True)st.markdown("")emergency = result.get("emergency_numbers", {})if emergency:emer_html = '<div class="emergency-card"><h4>π¨ Emergency Contacts</h4>'for label, num in emergency.items():emer_html += f"<p>π {label}: <b>{num}</b></p>"emer_html += "</div>"st.markdown(emer_html, unsafe_allow_html=True)
frontend/components/hospital_map.py+24-2