Skip to content

Commit c6a8877

Browse files
Use Streamlit instead of Dash
1 parent 5faa99f commit c6a8877

File tree

5 files changed

+103
-65
lines changed

5 files changed

+103
-65
lines changed

entrypoint.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ if [[ -n "${CMD}" ]];
77
then
88
python3 -m hackyeah2024.main ${CMD} ${CMD_ARGS}
99
else
10-
echo "No CLI command provided, running Dash server"
11-
python3 -m hackyeah2024.main server
10+
echo "No CLI command provided, running Streamlit server"
11+
python3 -m streamlit run hackyeah2024/server.py
1212
fi

hackyeah2024/main.py

-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ def dummy():
1616
@main.command()
1717
def server():
1818
print('Running server')
19-
run_server()
2019

2120

2221
if __name__ == '__main__':

hackyeah2024/server.py

+10-16
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,18 @@
1-
import dash_leaflet as dl
2-
from dash import Dash
1+
import folium
2+
import streamlit as st
33

4+
from streamlit_folium import st_folium
45

56
def run_server():
6-
# # A few cities in Denmark.
7-
# cities = [dict(title="Aalborg", position=[57.0268172, 9.837735]),
8-
# dict(title="Aarhus", position=[56.1780842, 10.1119354]),
9-
# dict(title="Copenhagen", position=[55.6712474, 12.5237848])]
7+
st.title('Rowerem przez Małopolskę')
108

11-
# # Create example app.
12-
# app = Dash()
13-
# app.layout = html.Div([
14-
# dl.Map(children=[dl.TileLayer()] + [dl.Marker(**city) for city in cities],
15-
# style={'width': '100%', 'height': '50vh', 'margin': "auto", "display": "block"}, id="map"),
16-
# ])
9+
# center on Liberty Bell, add marker
10+
map = folium.Map(location=[39.949610, -75.150282], zoom_start=16)
11+
marker = folium.Marker([39.949610, -75.150282], popup='Liberty Bell', tooltip='Liberty Bell')
12+
marker.add_to(map)
1713

18-
app = Dash()
19-
app.layout = dl.Map(dl.TileLayer(), center=[56, 10], zoom=6, style={'height': '50vh'})
20-
21-
app.run_server()
14+
# call to render Folium map in Streamlit
15+
st_data = st_folium(map, width=725)
2216

2317

2418
if __name__ == '__main__':

pyproject.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.10"
77
dependencies = [
8-
"dash",
9-
"dash_leaflet",
8+
"folium",
9+
"streamlit",
10+
"streamlit_folium",
1011
"taxicab",
1112
]
1213

requirements.txt

+88-44
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,19 @@
11
# This file was autogenerated by uv via the following command:
22
# uv pip compile pyproject.toml -o requirements.txt
3+
altair==5.4.1
4+
# via streamlit
5+
attrs==24.2.0
6+
# via
7+
# jsonschema
8+
# referencing
39
blinker==1.8.2
4-
# via flask
10+
# via streamlit
11+
branca==0.8.0
12+
# via
13+
# folium
14+
# streamlit-folium
15+
cachetools==5.5.0
16+
# via streamlit
517
certifi==2024.8.30
618
# via
719
# pyogrio
@@ -10,77 +22,92 @@ certifi==2024.8.30
1022
charset-normalizer==3.3.2
1123
# via requests
1224
click==8.1.7
13-
# via flask
25+
# via streamlit
1426
contourpy==1.3.0
1527
# via matplotlib
1628
cycler==0.12.1
1729
# via matplotlib
18-
dash==2.18.1
30+
folium==0.17.0
1931
# via
2032
# hackyeah2024 (pyproject.toml)
21-
# dash-leaflet
22-
dash-core-components==2.0.0
23-
# via dash
24-
dash-html-components==2.0.0
25-
# via dash
26-
dash-leaflet==1.0.15
27-
# via hackyeah2024 (pyproject.toml)
28-
dash-table==5.0.0
29-
# via dash
30-
flask==3.0.3
31-
# via dash
33+
# streamlit-folium
3234
fonttools==4.54.1
3335
# via matplotlib
3436
geopandas==1.0.1
3537
# via osmnx
38+
gitdb==4.0.11
39+
# via gitpython
40+
gitpython==3.1.43
41+
# via streamlit
3642
idna==3.10
3743
# via requests
38-
importlib-metadata==8.5.0
39-
# via dash
40-
itsdangerous==2.2.0
41-
# via flask
4244
jinja2==3.1.4
43-
# via flask
45+
# via
46+
# altair
47+
# branca
48+
# folium
49+
# pydeck
50+
# streamlit-folium
51+
jsonschema==4.23.0
52+
# via altair
53+
jsonschema-specifications==2023.12.1
54+
# via jsonschema
4455
kiwisolver==1.4.7
4556
# via matplotlib
57+
markdown-it-py==3.0.0
58+
# via rich
4659
markupsafe==2.1.5
47-
# via
48-
# jinja2
49-
# werkzeug
60+
# via jinja2
5061
matplotlib==3.9.2
5162
# via taxicab
52-
nest-asyncio==1.6.0
53-
# via dash
63+
mdurl==0.1.2
64+
# via markdown-it-py
65+
narwhals==1.8.4
66+
# via altair
5467
networkx==3.3
5568
# via
5669
# osmnx
5770
# taxicab
5871
numpy==2.1.1
5972
# via
6073
# contourpy
74+
# folium
6175
# geopandas
6276
# matplotlib
6377
# osmnx
6478
# pandas
79+
# pyarrow
80+
# pydeck
6581
# pyogrio
6682
# shapely
83+
# streamlit
6784
# taxicab
6885
osmnx==1.9.3
6986
# via taxicab
7087
packaging==24.1
7188
# via
89+
# altair
7290
# geopandas
7391
# matplotlib
74-
# plotly
7592
# pyogrio
93+
# streamlit
7694
pandas==2.2.3
7795
# via
7896
# geopandas
7997
# osmnx
98+
# streamlit
8099
pillow==10.4.0
81-
# via matplotlib
82-
plotly==5.24.1
83-
# via dash
100+
# via
101+
# matplotlib
102+
# streamlit
103+
protobuf==5.28.2
104+
# via streamlit
105+
pyarrow==17.0.0
106+
# via streamlit
107+
pydeck==0.9.1
108+
# via streamlit
109+
pygments==2.18.0
110+
# via rich
84111
pyogrio==0.9.0
85112
# via geopandas
86113
pyparsing==3.1.4
@@ -93,36 +120,53 @@ python-dateutil==2.9.0.post0
93120
# pandas
94121
pytz==2024.2
95122
# via pandas
123+
referencing==0.35.1
124+
# via
125+
# jsonschema
126+
# jsonschema-specifications
96127
requests==2.32.3
97128
# via
98-
# dash
129+
# folium
99130
# osmnx
100-
retrying==1.3.4
101-
# via dash
102-
setuptools==75.1.0
103-
# via dash
131+
# streamlit
132+
rich==13.8.1
133+
# via streamlit
134+
rpds-py==0.20.0
135+
# via
136+
# jsonschema
137+
# referencing
104138
shapely==2.0.6
105139
# via
106140
# geopandas
107141
# osmnx
108142
# taxicab
109143
six==1.16.0
144+
# via python-dateutil
145+
smmap==5.0.1
146+
# via gitdb
147+
streamlit==1.38.0
110148
# via
111-
# python-dateutil
112-
# retrying
149+
# hackyeah2024 (pyproject.toml)
150+
# streamlit-folium
151+
streamlit-folium==0.22.1
152+
# via hackyeah2024 (pyproject.toml)
113153
taxicab==0.0.3
114154
# via hackyeah2024 (pyproject.toml)
115-
tenacity==9.0.0
116-
# via plotly
155+
tenacity==8.5.0
156+
# via streamlit
157+
toml==0.10.2
158+
# via streamlit
159+
tornado==6.4.1
160+
# via streamlit
117161
typing-extensions==4.12.2
118-
# via dash
162+
# via
163+
# altair
164+
# streamlit
119165
tzdata==2024.2
120166
# via pandas
121167
urllib3==2.2.3
122168
# via requests
123-
werkzeug==3.0.4
124-
# via
125-
# dash
126-
# flask
127-
zipp==3.20.2
128-
# via importlib-metadata
169+
watchdog==4.0.2
170+
# via streamlit
171+
xyzservices==2024.9.0
172+
# via folium

0 commit comments

Comments
 (0)