Spaces:
Build error
Build error
grimbano
commited on
Commit
·
df72e07
1
Parent(s):
756bd07
fix: :bug: Trying to fix cache permission problems
Browse files- Dockerfile +3 -0
- src/streamlit_app.py +8 -7
Dockerfile
CHANGED
|
@@ -9,6 +9,9 @@ RUN apt-get update && apt-get install -y \
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
COPY requirements.txt ./
|
| 13 |
COPY src/ ./src/
|
| 14 |
|
|
|
|
| 9 |
git \
|
| 10 |
&& rm -rf /var/lib/apt/lists/*
|
| 11 |
|
| 12 |
+
# Set cache in /tmp (recommended in Spaces)
|
| 13 |
+
ENV HF_HOME=/tmp/huggingface
|
| 14 |
+
|
| 15 |
COPY requirements.txt ./
|
| 16 |
COPY src/ ./src/
|
| 17 |
|
src/streamlit_app.py
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
from similarity import PokemonSimilarity
|
| 4 |
-
import os
|
| 5 |
import logging
|
| 6 |
|
| 7 |
|
|
@@ -16,12 +23,6 @@ logging.basicConfig(
|
|
| 16 |
logger = logging.getLogger(__name__)
|
| 17 |
|
| 18 |
|
| 19 |
-
# Definir ruta temporal para evitar errores de permisos
|
| 20 |
-
os.environ['HF_HOME'] = '/tmp/huggingface'
|
| 21 |
-
os.environ['TRANSFORMERS_CACHE'] = '/tmp/huggingface'
|
| 22 |
-
|
| 23 |
-
# Crear el directorio si no existe
|
| 24 |
-
os.makedirs('/tmp/huggingface', exist_ok=True)
|
| 25 |
|
| 26 |
|
| 27 |
# Set page config first
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
# Define temporal path for fixing issues
|
| 3 |
+
os.environ['HF_HOME'] = '/tmp/huggingface'
|
| 4 |
+
|
| 5 |
+
# Create the path if it doesn't exists
|
| 6 |
+
os.makedirs('/tmp/huggingface', exist_ok=True)
|
| 7 |
+
|
| 8 |
+
|
| 9 |
import streamlit as st
|
| 10 |
from PIL import Image
|
| 11 |
from similarity import PokemonSimilarity
|
|
|
|
| 12 |
import logging
|
| 13 |
|
| 14 |
|
|
|
|
| 23 |
logger = logging.getLogger(__name__)
|
| 24 |
|
| 25 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
|
| 28 |
# Set page config first
|