Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import folium
|
2 |
|
3 |
def create_marker(bird):
|
@@ -32,7 +33,21 @@ birds = [
|
|
32 |
{'species': 'Hooded Merganser', 'lat': 44.8835, 'lon': -93.2273, 'start_month': 'October', 'end_month': 'April'}
|
33 |
]
|
34 |
|
|
|
35 |
markers = [create_marker(bird) for bird in birds]
|
|
|
|
|
36 |
center = [44.9778, -93.2650]
|
37 |
zoom = 8
|
38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
import folium
|
3 |
|
4 |
def create_marker(bird):
|
|
|
33 |
{'species': 'Hooded Merganser', 'lat': 44.8835, 'lon': -93.2273, 'start_month': 'October', 'end_month': 'April'}
|
34 |
]
|
35 |
|
36 |
+
# Create list of markers for each bird species
|
37 |
markers = [create_marker(bird) for bird in birds]
|
38 |
+
|
39 |
+
# Define the center and zoom of the map
|
40 |
center = [44.9778, -93.2650]
|
41 |
zoom = 8
|
42 |
+
|
43 |
+
# Create the Streamlit app
|
44 |
+
st.title("Bird Migration Map")
|
45 |
+
month = st.slider("Select a month", 1, 12, 1)
|
46 |
+
|
47 |
+
# Filter the markers by the selected month
|
48 |
+
selected_markers = [marker for marker in markers if month >= list(calendar.month_abbr).index(marker['start_month'][:3]) and month <= list(calendar.month_abbr).index
|
49 |
+
# Create the map with the filtered markers
|
50 |
+
m = create_map(center, zoom, selected_markers)
|
51 |
+
|
52 |
+
# Display the map on the Streamlit app
|
53 |
+
folium_static(m)
|