GeminiAi commited on
Commit
be7ca7e
·
1 Parent(s): f3e752c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -31,17 +31,16 @@ def main():
31
  var lng = event.latLng.lng();
32
  var message = 'Selected Coordinates: ' + lat + ', ' + lng;
33
  document.getElementById('selected-coordinates').innerHTML = message;
34
- Streamlit.setComponentValue({{ lat: lat, lng: lng }});
35
  }}
36
  </script>
37
  """
38
- result = st.components.v1.html(map_code, height=600, scrolling=True)
39
 
40
- # Get the selected coordinates from the JavaScript callback
41
- if result:
42
- selected_coordinates = st.session_state.lat, st.session_state.lng
43
- if selected_coordinates:
44
- st.write(f"Selected Coordinates: {selected_coordinates[0]}, {selected_coordinates[1]}")
45
 
46
  if __name__ == "__main__":
47
  main()
 
31
  var lng = event.latLng.lng();
32
  var message = 'Selected Coordinates: ' + lat + ', ' + lng;
33
  document.getElementById('selected-coordinates').innerHTML = message;
34
+ Streamlit.setSessionState({{ lat: lat, lng: lng }});
35
  }}
36
  </script>
37
  """
38
+ st.components.v1.html(map_code, height=600, scrolling=True)
39
 
40
+ # Get the selected coordinates from the session state
41
+ selected_coordinates = st.session_state.lat, st.session_state.lng
42
+ if selected_coordinates[0] is not None and selected_coordinates[1] is not None:
43
+ st.write(f"Selected Coordinates: {selected_coordinates[0]}, {selected_coordinates[1]}")
 
44
 
45
  if __name__ == "__main__":
46
  main()