Spaces:
Sleeping
Sleeping
Update backup.app.py
Browse files- 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),
|
|
|
|
|
|
|
|
|
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 |
-
#
|
24 |
-
|
|
|
|
|
|
|
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 |
-
|
31 |
with col2:
|
32 |
if st.button(hospitals[1][0]):
|
33 |
-
|
34 |
with col3:
|
35 |
if st.button(hospitals[2][0]):
|
36 |
-
|
37 |
|
38 |
col4, col5, col6 = st.columns(3)
|
39 |
with col4:
|
40 |
if st.button(hospitals[3][0]):
|
41 |
-
|
42 |
with col5:
|
43 |
if st.button(hospitals[4][0]):
|
44 |
-
|
|
|
|
|
|
|
|
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)
|