campusevents's picture
Update Dockerfile
9793636 verified
Raw
History Blame Contribute Delete
908 Bytes
FROM python:3.14-slim
WORKDIR /app
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PORT=7860
ENV MODEL_ID=campusevents/Bert_sentiment_analysis
COPY requirements.txt .
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
git \
&& rm -rf /var/lib/apt/lists/*
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
RUN python -c "\
from transformers import AutoTokenizer, AutoModelForSequenceClassification; \
AutoTokenizer.from_pretrained('campusevents/Bert_sentiment_analysis'); \
AutoModelForSequenceClassification.from_pretrained('campusevents/Bert_sentiment_analysis'); \
print('Model cached.')"
COPY bert_sentiment.py .
EXPOSE 7860
CMD ["gunicorn", "bert_sentiment:app", \
"--bind", "0.0.0.0:7860", \
"--workers", "1", \
"--timeout", "180", \
"--preload"]