cboettig commited on
Commit
8e169eb
β€’
1 Parent(s): d88966c

docker-based

Browse files
Files changed (4) hide show
  1. Dockerfile +11 -0
  2. README.md +4 -7
  3. app.py +14 -13
  4. requirements.txt +1 -11
Dockerfile ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM gitlab-registry.nrp-nautilus.io/cboettig/images
2
+ WORKDIR /app
3
+
4
+ COPY . .
5
+
6
+ # huggingface uses port 7860 by default
7
+ CMD streamlit run app.py \
8
+ --server.address 0.0.0.0 \
9
+ --server.port 7860 \
10
+ --server.headless true \
11
+ --server.fileWatcherType none
README.md CHANGED
@@ -1,14 +1,11 @@
1
  ---
2
  title: Streamlit Demo
3
  emoji: 🌍
4
- colorFrom: indigo
5
- colorTo: pink
6
- sdk: streamlit
7
- sdk_version: 1.40.1
8
- app_file: app.py
9
  pinned: false
10
  license: bsd-2-clause
11
- short_description: demonstration of streamlit for espm-157
12
  ---
13
 
14
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Streamlit Demo
3
  emoji: 🌍
4
+ colorFrom: yellow
5
+ colorTo: indigo
6
+ sdk: docker
 
 
7
  pinned: false
8
  license: bsd-2-clause
 
9
  ---
10
 
11
+
app.py CHANGED
@@ -1,21 +1,22 @@
1
  import streamlit as st
 
2
  import ibis
3
  from ibis import _
4
- import leafmap.maplibregl as leafmap
5
-
6
-
7
- st.title("_Streamlit_ is :blue[cool] :sunglasses:")
8
-
9
- city_name = st.text_input("Which City?", "Oakland")
10
 
11
 
 
 
12
 
13
- con = ibis.duckdb.connect(extensions=["spatial"])
14
- redlines = con.read_geo("https://data.source.coop/cboettig/us-boundaries/mappinginequality.json")
15
- city = redlines.filter(_.city == city_name).execute()
 
 
 
16
 
 
 
 
 
17
 
18
- m = leafmap.Map()
19
- m.add_cog_layer("https://espm-157-f24.github.io/spatial-carl-amanda-tyler/ndvi.tif", palette = "greens")
20
- m.add_gdf(city)
21
- m.to_streamlit()
 
1
  import streamlit as st
2
+ import leafmap.maplibregl as leafmap
3
  import ibis
4
  from ibis import _
5
+ con = ibis.duckdb.connect()
 
 
 
 
 
6
 
7
 
8
+ # fixme could create drop-down selection of the 300 cities
9
+ city_name = st.text_input("Select a city", "New Haven")
10
 
11
+ # Extract the specified city
12
+ city = (con
13
+ .read_geo("/vsicurl/https://dsl.richmond.edu/panorama/redlining/static/mappinginequality.gpkg")
14
+ .filter(_.city == city_name, _.residential)
15
+ .execute()
16
+ )
17
 
18
+ # Render the map
19
+ m = leafmap.Map(style="positron")
20
+ m.add_gdf(city, "fill", paint = {"fill-color": ["get", "fill"], "fill-opacity": 0.8})
21
+ m.to_streamlit()
22
 
 
 
 
 
requirements.txt CHANGED
@@ -1,11 +1 @@
1
- pandas
2
- seaborn
3
- ibis-framework[duckdb]
4
- nbval
5
- leafmap[maplibre]
6
- geopandas
7
- pystac-client
8
- odc-stac
9
- rioxarray
10
- exactextract
11
- git+https://github.com/eodaGmbH/py-maplibregl@feature/color-utils
 
1
+ streamlit