""" Browser GPS component for Streamlit. Uses JavaScript Geolocation API to get user's real-time position. """ import streamlit as st import streamlit.components.v1 as components def gps_button(): """ Renders a GPS button. When clicked, asks browser for location. Returns (lat, lon) or (None, None) if denied/unavailable. Usage: if st.button('📍 Use My GPS Location'): lat, lon = gps_button() if lat: st.session_state.lat = lat st.session_state.lon = lon """ html = """ """ # This won't work perfectly in Streamlit due to component lifecycle, # but we'll use a simpler approach: direct JS-inject return html # Simpler approach: use st.components.v1.html with callback GPS_HTML = """
"""