Spaces:
Sleeping
Sleeping
Decalred the cache folder for the transformers
Browse files- Dockerfile +7 -10
Dockerfile
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
-
#
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
-
# Set
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy your code
|
|
@@ -10,15 +10,12 @@ COPY . /app
|
|
| 10 |
# Install dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
EXPOSE 7860
|
| 15 |
|
| 16 |
# Start the Flask app
|
| 17 |
CMD ["python", "app.py"]
|
| 18 |
-
|
| 19 |
-
# Create a writable cache directory
|
| 20 |
-
RUN mkdir -p /app/cache
|
| 21 |
-
|
| 22 |
-
# Tell transformers/huggingface to use it
|
| 23 |
-
ENV HF_HOME=/app/cache
|
| 24 |
-
ENV TRANSFORMERS_CACHE=/app/cache
|
|
|
|
| 1 |
+
# Base image
|
| 2 |
FROM python:3.10-slim
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy your code
|
|
|
|
| 10 |
# Install dependencies
|
| 11 |
RUN pip install --no-cache-dir -r requirements.txt
|
| 12 |
|
| 13 |
+
# Set Hugging Face cache to a writable folder
|
| 14 |
+
# /tmp is always writable in HF Spaces
|
| 15 |
+
ENV HF_HOME=/tmp/hf_cache
|
| 16 |
+
|
| 17 |
+
# Expose the Flask port for HF Spaces
|
| 18 |
EXPOSE 7860
|
| 19 |
|
| 20 |
# Start the Flask app
|
| 21 |
CMD ["python", "app.py"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|