Spaces:
Runtime error
Runtime error
scontess
commited on
Commit
ยท
7e16ca0
1
Parent(s):
3472a3b
pippo
Browse files- Dockerfile +3 -0
- src/streamlit_app.py +4 -0
Dockerfile
CHANGED
@@ -18,6 +18,9 @@ RUN chmod -R 755 /app
|
|
18 |
|
19 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
20 |
|
|
|
|
|
|
|
21 |
|
22 |
EXPOSE 8501
|
23 |
|
|
|
18 |
|
19 |
RUN mkdir -p /app/.cache && chmod -R 777 /app/.cache
|
20 |
|
21 |
+
RUN useradd -m streamlit_user && chown -R streamlit_user /app/.cache
|
22 |
+
USER streamlit_user
|
23 |
+
|
24 |
|
25 |
EXPOSE 8501
|
26 |
|
src/streamlit_app.py
CHANGED
@@ -13,6 +13,7 @@ from sklearn.metrics import confusion_matrix
|
|
13 |
import seaborn as sns
|
14 |
from huggingface_hub import HfApi
|
15 |
import os
|
|
|
16 |
|
17 |
# ๐ Percorso della cartella dove sarร salvato il dataset se uso TFlow, non serve se setto hf_dataset_cache
|
18 |
#DATA_DIR = "/app" #"/tmp"
|
@@ -53,6 +54,9 @@ try:
|
|
53 |
except PermissionError:
|
54 |
st.error("โ ERRORE: La cartella /app/.cache non ha permessi di scrittura!")
|
55 |
|
|
|
|
|
|
|
56 |
# ๐ Carica il dataset direttamente da Hugging Face
|
57 |
dataset = load_dataset("sradc/imagenet_resized_64x64", split="train")
|
58 |
|
|
|
13 |
import seaborn as sns
|
14 |
from huggingface_hub import HfApi
|
15 |
import os
|
16 |
+
from datasets.utils import disable_caching
|
17 |
|
18 |
# ๐ Percorso della cartella dove sarร salvato il dataset se uso TFlow, non serve se setto hf_dataset_cache
|
19 |
#DATA_DIR = "/app" #"/tmp"
|
|
|
54 |
except PermissionError:
|
55 |
st.error("โ ERRORE: La cartella /app/.cache non ha permessi di scrittura!")
|
56 |
|
57 |
+
|
58 |
+
disable_caching()
|
59 |
+
os.environ["HF_DATASETS_CACHE"] = "/app/.cache"
|
60 |
# ๐ Carica il dataset direttamente da Hugging Face
|
61 |
dataset = load_dataset("sradc/imagenet_resized_64x64", split="train")
|
62 |
|