File size: 508 Bytes
fad8517
 
 
 
eead084
fad8517
 
 
eead084
 
 
 
fad8517
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
FROM python:3.9-slim

WORKDIR /app

# Install dependencies first (to cache this layer)
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Pre-download the model so it's baked into the image
# This prevents the container from downloading it at runtime
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english')"

COPY . .

CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]