ybendou commited on
Commit
f9088de
1 Parent(s): a2d0aab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -207,24 +207,24 @@ interventions_df = add_latlng_col(interventions_df, process_column=12)
207
  # Get current location:
208
 
209
  js_code = """
210
- function getLocation() {
211
- navigator.geolocation.getCurrentPosition(function (position) {
212
- document.getElementById("localisation").value = JSON.stringify({
213
- latitude: position.coords.latitude,
214
- longitude: position.coords.longitude
215
- });
216
- document.getElementById("localisation").dispatchEvent(new Event('input', { 'bubbles': true }));
217
- }, function () {
218
- document.getElementById("localisation").value = JSON.stringify({
219
- latitude: null,
220
- longitude: null
221
- });
222
- document.getElementById("localisation").dispatchEvent(new Event('input', { 'bubbles': true }));
223
  });
224
- }
225
- getLocation();
226
- """
227
- st.markdown(f"<script>{js_code}</script>", unsafe_allow_html=True)
 
 
 
 
 
 
 
 
228
 
229
  # Hidden field to store the JavaScript variable
230
  current_localisation = st.text_input("localisation", "", key="localisation", type="hidden")
 
207
  # Get current location:
208
 
209
  js_code = """
210
+ function getLocation() {
211
+ navigator.geolocation.getCurrentPosition(function (position) {
212
+ document.getElementById("localisation").value = JSON.stringify({
213
+ latitude: position.coords.latitude,
214
+ longitude: position.coords.longitude
 
 
 
 
 
 
 
 
215
  });
216
+ document.getElementById("localisation").dispatchEvent(new Event('input', { 'bubbles': true }));
217
+ }, function () {
218
+ document.getElementById("localisation").value = JSON.stringify({
219
+ latitude: null,
220
+ longitude: null
221
+ });
222
+ document.getElementById("localisation").dispatchEvent(new Event('input', { 'bubbles': true }));
223
+ });
224
+ }
225
+ getLocation();
226
+ """
227
+ st.markdown(f"<script>{js_code}</script>", unsafe_allow_html=True)
228
 
229
  # Hidden field to store the JavaScript variable
230
  current_localisation = st.text_input("localisation", "", key="localisation", type="hidden")