cboettig commited on
Commit
cb04c03
Β·
1 Parent(s): c5d7ece

here we go!

Browse files
Files changed (4) hide show
  1. Dockerfile +11 -0
  2. Makefile +18 -0
  3. README.md +13 -4
  4. app.py +23 -0
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
Makefile ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ BASE="nature.datahub.berkeley.edu"
2
+ MAKEFLAGS += s
3
+
4
+ .PHONY: serve
5
+ serve:
6
+ @echo "\n 🌎 preview at: \033[1m https://${BASE}${JUPYTERHUB_SERVICE_PREFIX}proxy/8501/ \033[0m \n"
7
+ streamlit run app.py --server.port 8501 1> /dev/null 2>&1
8
+
9
+
10
+ .PHONY: chat
11
+ chat:
12
+ @echo "\n 🌎 preview at: \033[1m https://${BASE}${JUPYTERHUB_SERVICE_PREFIX}proxy/8501/ \033[0m \n"
13
+ streamlit run chat.py --server.port 8501 1> /dev/null 2>&1
14
+
15
+ .PHONY: rag
16
+ rag:
17
+ @echo "\n 🌎 preview at: \033[1m https://${BASE}${JUPYTERHUB_SERVICE_PREFIX}proxy/8501/ \033[0m \n"
18
+ streamlit run rag.py --server.port 8501 1> /dev/null 2>&1
README.md CHANGED
@@ -1,10 +1,19 @@
1
  ---
2
- title: Final Team Awesome
3
- emoji: 🐨
4
  colorFrom: yellow
5
- colorTo: blue
6
  sdk: docker
7
  pinned: false
 
8
  ---
9
 
10
- 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
+ For ESPM-157 students using <https://nature.datahub.berkeley.edu> servers:
12
+ To preview locally, use
13
+
14
+ ```
15
+ make
16
+ ```
17
+
18
+ and click the link provided
19
+
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ st.title("My title")
8
+
9
+ # fixme could create drop-down selection of the 300 cities
10
+ city_name = st.text_input("Select a city", "New Haven")
11
+
12
+ # Extract the specified city
13
+ city = (con
14
+ .read_geo("/vsicurl/https://dsl.richmond.edu/panorama/redlining/static/mappinginequality.gpkg")
15
+ .filter(_.city == city_name, _.residential)
16
+ .execute()
17
+ )
18
+
19
+ # Render the map
20
+ m = leafmap.Map(style="positron")
21
+ m.add_gdf(city, "fill", paint = {"fill-color": ["get", "fill"], "fill-opacity": 0.8})
22
+ m.to_streamlit()
23
+