Spaces:
Runtime error
Runtime error
# Use an official Python runtime as a parent image | |
FROM python:3.10-slim-buster | |
# Set the working directory in the container | |
WORKDIR /app | |
# Copy the requirements file into the container at /app | |
COPY requirements.txt . | |
# Install any needed packages specified in requirements.txt | |
# Also, download textblob corpora | |
RUN pip install --no-cache-dir -r requirements.txt \ | |
&& python -m textblob.download_corpora | |
# --- UPDATED HUGGING FACE MODELS PRE-DOWNLOAD --- | |
# Sentiment Model (already correct) | |
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='cardiffnlp/twitter-roberta-base-sentiment-latest')" | |
# Sarcasm/Irony Model (CORRECTED) | |
RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; tokenizer = AutoTokenizer.from_pretrained('cardiffnlp/twitter-roberta-base-irony'); model = AutoModelForSequenceClassification.from_pretrained('cardiffnlp/twitter-roberta-base-irony')" | |
# --- END OF UPDATED LINES --- | |
# Copy the entire project directory into the container at /app | |
COPY . . | |
# Expose the port that Streamlit runs on | |
EXPOSE 8501 | |
# Define the command to run the Streamlit application | |
# Streamlit runs on 0.0.0.0 by default in Docker | |
CMD ["streamlit", "run", "frontend/app.py", "--server.port=8501", "--server.address=0.0.0.0"] |