awacke1 commited on
Commit
cfa259c
·
1 Parent(s): 9c687ec

Update backup.app.py

Browse files
Files changed (1) hide show
  1. backup.app.py +18 -8
backup.app.py CHANGED
@@ -3,7 +3,11 @@ import folium
3
  from streamlit_folium import folium_static
4
 
5
  # Define hospitals data for Minnesota
6
- hospitals = [('Mayo Clinic', 'Rochester', 44.023678, -92.466955), ('University of Minnesota Medical Center', 'Minneapolis', 44.971389, -93.240556), ('Hennepin County Medical Center', 'Minneapolis', 44.972078, -93.261769), ('Regions Hospital', 'St. Paul', 44.942936, -93.093457), ('Abbott Northwestern Hospital', 'Minneapolis', 44.955447, -93.268543)]
 
 
 
 
7
 
8
  # Create a map centered on Minnesota
9
  m = folium.Map(location=[45.0, -94.0], zoom_start=7)
@@ -20,25 +24,31 @@ for hospital in hospitals:
20
  waypoints = [(hospital[2], hospital[3]) for hospital in hospitals]
21
  folium.plugins.AntPath(waypoints, delay=3000).add_to(m)
22
 
23
- # Display the map in Streamlit
24
- folium_static(m)
 
 
 
25
 
26
  # Create a grid of buttons for selecting hospitals
27
  col1, col2, col3 = st.columns(3)
28
  with col1:
29
  if st.button(hospitals[0][0]):
30
- m.location = [hospitals[0][2], hospitals[0][3]]
31
  with col2:
32
  if st.button(hospitals[1][0]):
33
- m.location = [hospitals[1][2], hospitals[1][3]]
34
  with col3:
35
  if st.button(hospitals[2][0]):
36
- m.location = [hospitals[2][2], hospitals[2][3]]
37
 
38
  col4, col5, col6 = st.columns(3)
39
  with col4:
40
  if st.button(hospitals[3][0]):
41
- m.location = [hospitals[3][2], hospitals[3][3]]
42
  with col5:
43
  if st.button(hospitals[4][0]):
44
- m.location = [hospitals[4][2], hospitals[4][3]]
 
 
 
 
3
  from streamlit_folium import folium_static
4
 
5
  # Define hospitals data for Minnesota
6
+ hospitals = [('Mayo Clinic', 'Rochester', 44.023678, -92.466955),
7
+ ('University of Minnesota Medical Center', 'Minneapolis', 44.971389, -93.240556),
8
+ ('Hennepin County Medical Center', 'Minneapolis', 44.972078, -93.261769),
9
+ ('Regions Hospital', 'St. Paul', 44.942936, -93.093457),
10
+ ('Abbott Northwestern Hospital', 'Minneapolis', 44.955447, -93.268543)]
11
 
12
  # Create a map centered on Minnesota
13
  m = folium.Map(location=[45.0, -94.0], zoom_start=7)
 
24
  waypoints = [(hospital[2], hospital[3]) for hospital in hospitals]
25
  folium.plugins.AntPath(waypoints, delay=3000).add_to(m)
26
 
27
+ # Function to update the map when a button is clicked
28
+ def update_map(hospital_data):
29
+ m.location = [hospital_data[2], hospital_data[3]]
30
+ m.zoom_start = 13
31
+ folium_static(m)
32
 
33
  # Create a grid of buttons for selecting hospitals
34
  col1, col2, col3 = st.columns(3)
35
  with col1:
36
  if st.button(hospitals[0][0]):
37
+ update_map(hospitals[0])
38
  with col2:
39
  if st.button(hospitals[1][0]):
40
+ update_map(hospitals[1])
41
  with col3:
42
  if st.button(hospitals[2][0]):
43
+ update_map(hospitals[2])
44
 
45
  col4, col5, col6 = st.columns(3)
46
  with col4:
47
  if st.button(hospitals[3][0]):
48
+ update_map(hospitals[3])
49
  with col5:
50
  if st.button(hospitals[4][0]):
51
+ update_map(hospitals[4])
52
+
53
+ # Display the map in Streamlit
54
+ folium_static(m)