Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +11 -7
Dockerfile
CHANGED
|
@@ -5,17 +5,21 @@ FROM python:3.9
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy files
|
| 8 |
-
COPY requirements.txt .
|
| 9 |
-
COPY main.py .
|
| 10 |
|
| 11 |
# Install dependencies
|
| 12 |
-
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
-
# Set cache directory
|
| 15 |
-
ENV
|
| 16 |
|
| 17 |
-
#
|
| 18 |
-
RUN
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
# Expose port for FastAPI
|
| 21 |
EXPOSE 7860
|
|
|
|
| 5 |
WORKDIR /app
|
| 6 |
|
| 7 |
# Copy files
|
| 8 |
+
COPY requirements.txt .
|
| 9 |
+
COPY main.py .
|
| 10 |
|
| 11 |
# Install dependencies
|
| 12 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 13 |
|
| 14 |
+
# Set cache directory (Use HF_HOME instead of TRANSFORMERS_CACHE)
|
| 15 |
+
ENV HF_HOME="/tmp/huggingface"
|
| 16 |
|
| 17 |
+
# Ensure the directory exists
|
| 18 |
+
RUN mkdir -p $HF_HOME
|
| 19 |
+
|
| 20 |
+
# Pre-download the correct models (Multilingual + English sentiment analysis)
|
| 21 |
+
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='tabularisai/multilingual-sentiment-analysis')"
|
| 22 |
+
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='siebert/sentiment-roberta-large-english')"
|
| 23 |
|
| 24 |
# Expose port for FastAPI
|
| 25 |
EXPOSE 7860
|