Spaces:
Runtime error
Runtime error
Numan sheikh
commited on
Commit
·
d506599
1
Parent(s):
2e338d1
Add model pre-download steps to Dockerfile to prevent timeout
Browse files- Dockerfile +12 -2
Dockerfile
CHANGED
|
@@ -8,10 +8,20 @@ WORKDIR /app
|
|
| 8 |
COPY requirements.txt .
|
| 9 |
|
| 10 |
# Install any needed packages specified in requirements.txt
|
| 11 |
-
# Also, download textblob corpora
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt \
|
| 13 |
&& python -m textblob.download_corpora
|
| 14 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
# Copy the entire project directory into the container at /app
|
| 16 |
COPY . .
|
| 17 |
|
|
@@ -20,4 +30,4 @@ EXPOSE 8501
|
|
| 20 |
|
| 21 |
# Define the command to run the Streamlit application
|
| 22 |
# Streamlit runs on 0.0.0.0 by default in Docker
|
| 23 |
-
CMD ["streamlit", "run", "frontend/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|
|
|
|
| 8 |
COPY requirements.txt .
|
| 9 |
|
| 10 |
# Install any needed packages specified in requirements.txt
|
| 11 |
+
# Also, download textblob corpora
|
| 12 |
RUN pip install --no-cache-dir -r requirements.txt \
|
| 13 |
&& python -m textblob.download_corpora
|
| 14 |
|
| 15 |
+
# --- ADD THESE LINES TO PRE-DOWNLOAD HUGGING FACE MODELS ---
|
| 16 |
+
# You need to know the exact model IDs your sentiment and sarcasm scripts use.
|
| 17 |
+
# I'll use common examples. Adjust if your models are different.
|
| 18 |
+
# Example for Sentiment Model (adjust model name if yours is different):
|
| 19 |
+
RUN python -c "from transformers import pipeline; pipeline('sentiment-analysis', model='cardiffnlp/twitter-roberta-base-sentiment-latest')"
|
| 20 |
+
|
| 21 |
+
# Example for Sarcasm Model (adjust model name if yours is different):
|
| 22 |
+
RUN python -c "from transformers import AutoTokenizer, AutoModelForSequenceClassification; tokenizer = AutoTokenizer.from_pretrained('mrm8488/distilroberta-base-finetuned-sarcasm'); model = AutoModelForSequenceClassification.from_pretrained('mrm8488/distilroberta-base-finetuned-sarcasm')"
|
| 23 |
+
# --- END OF ADDED LINES ---
|
| 24 |
+
|
| 25 |
# Copy the entire project directory into the container at /app
|
| 26 |
COPY . .
|
| 27 |
|
|
|
|
| 30 |
|
| 31 |
# Define the command to run the Streamlit application
|
| 32 |
# Streamlit runs on 0.0.0.0 by default in Docker
|
| 33 |
+
CMD ["streamlit", "run", "frontend/app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|