Anthony Truchet commited on
Commit ·
f92ad8c
1
Parent(s): 2695dfd
refactor: clean up the files layout
Browse files- .streamlit/config.toml +6 -0
- Dockerfile +8 -9
- src/{static → apps/static}/cat.jpeg +0 -0
- src/{app.py → apps/streamlit_demo.py} +2 -1
.streamlit/config.toml
CHANGED
|
@@ -11,6 +11,12 @@ headless = true
|
|
| 11 |
address = "0.0.0.0"
|
| 12 |
port = 8501
|
| 13 |
enableStaticServing = true
|
|
|
|
|
|
|
| 14 |
|
| 15 |
[browser]
|
| 16 |
gatherUsageStats = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
address = "0.0.0.0"
|
| 12 |
port = 8501
|
| 13 |
enableStaticServing = true
|
| 14 |
+
allowRunOnSave = true
|
| 15 |
+
|
| 16 |
|
| 17 |
[browser]
|
| 18 |
gatherUsageStats = false
|
| 19 |
+
|
| 20 |
+
[logger]
|
| 21 |
+
enableRich = true
|
| 22 |
+
level = "info"
|
Dockerfile
CHANGED
|
@@ -36,19 +36,18 @@ COPY --chown=user:user --chmod=u=rX .streamlit/ $APP_HOME/.streamlit/
|
|
| 36 |
# $ docker ... --mount type=volume,src=ai-playground-vol,dst=/data ...
|
| 37 |
# see https://huggingface.co/docs/hub/spaces-storage
|
| 38 |
VOLUME /data
|
| 39 |
-
RUN mkdir -p /data && chown user:user /data
|
| 40 |
-
RUN mkdir -p $APP_DATA && chown user:user $APP_DATA
|
| 41 |
-
RUN mkdir -p $HF_HOME && chown user:user $HF_HOME
|
| 42 |
|
| 43 |
# User
|
| 44 |
USER user
|
| 45 |
-
ENV HOME
|
| 46 |
-
ENV PATH
|
|
|
|
| 47 |
WORKDIR $APP_HOME
|
| 48 |
|
| 49 |
# Expose streamlit application
|
| 50 |
EXPOSE 8501
|
| 51 |
-
CMD
|
| 52 |
-
|
| 53 |
-
--server.enableXsrfProtection=true
|
| 54 |
-
--server.fileWatcherType=auto
|
|
|
|
|
|
| 36 |
# $ docker ... --mount type=volume,src=ai-playground-vol,dst=/data ...
|
| 37 |
# see https://huggingface.co/docs/hub/spaces-storage
|
| 38 |
VOLUME /data
|
|
|
|
|
|
|
|
|
|
| 39 |
|
| 40 |
# User
|
| 41 |
USER user
|
| 42 |
+
ENV HOME=$APP_HOME
|
| 43 |
+
ENV PATH=$HOME/.local/bin:$PATH
|
| 44 |
+
ENV PYTHONPATH=$APP_CODE:$PYTHONPATH
|
| 45 |
WORKDIR $APP_HOME
|
| 46 |
|
| 47 |
# Expose streamlit application
|
| 48 |
EXPOSE 8501
|
| 49 |
+
CMD mkdir -p $APP_DATA $HF_HOME && \
|
| 50 |
+
streamlit run \
|
| 51 |
+
--server.enableXsrfProtection=true \
|
| 52 |
+
--server.fileWatcherType=auto \
|
| 53 |
+
$APP_CODE/apps/streamlit_demo.py
|
src/{static → apps/static}/cat.jpeg
RENAMED
|
File without changes
|
src/{app.py → apps/streamlit_demo.py}
RENAMED
|
@@ -18,7 +18,8 @@ DATA_PATH = Path(os.environ.get("APP_DATA"))
|
|
| 18 |
|
| 19 |
@st.cache_resource
|
| 20 |
def load_data(nrows):
|
| 21 |
-
data = cached_download_csv(DATA_PATH, DATA_URL,
|
|
|
|
| 22 |
def lowercase(x):
|
| 23 |
return str(x).lower()
|
| 24 |
|
|
|
|
| 18 |
|
| 19 |
@st.cache_resource
|
| 20 |
def load_data(nrows):
|
| 21 |
+
data = cached_download_csv(DATA_PATH, DATA_URL,
|
| 22 |
+
nrows=nrows)
|
| 23 |
def lowercase(x):
|
| 24 |
return str(x).lower()
|
| 25 |
|