JohnDoee commited on
Commit
f6e220a
·
1 Parent(s): 8aec507

Update Dockerfile

Browse files
Files changed (1) hide show
  1. 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 TRANSFORMERS_CACHE="/app/cache"
16
 
17
- # Pre-download the model (to avoid runtime downloads)
18
- RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')"
 
 
 
 
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