Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +25 -5
Dockerfile
CHANGED
@@ -3,19 +3,39 @@ FROM python:3.9-slim
|
|
3 |
# Set working directory
|
4 |
WORKDIR /app
|
5 |
|
6 |
-
#
|
7 |
ENV HF_HOME=/app/.cache/huggingface
|
|
|
|
|
|
|
|
|
|
|
8 |
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
|
9 |
|
10 |
-
# Install
|
|
|
|
|
|
|
|
|
|
|
11 |
COPY requirements.txt .
|
12 |
RUN pip install --no-cache-dir -r requirements.txt
|
13 |
|
14 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
COPY . .
|
16 |
|
17 |
-
# Expose Streamlit port
|
18 |
EXPOSE 7860
|
19 |
|
20 |
-
# Start Streamlit app
|
21 |
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|
|
|
3 |
# Set working directory
|
4 |
WORKDIR /app
|
5 |
|
6 |
+
# Avoid Hugging Face permission warnings and force CPU
|
7 |
ENV HF_HOME=/app/.cache/huggingface
|
8 |
+
ENV TRANSFORMERS_CACHE=$HF_HOME
|
9 |
+
ENV HF_DATASETS_CACHE=$HF_HOME/datasets
|
10 |
+
ENV HF_METRICS_CACHE=$HF_HOME/metrics
|
11 |
+
|
12 |
+
# Create and set permission to the cache folder
|
13 |
RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME
|
14 |
|
15 |
+
# Install system dependencies
|
16 |
+
RUN apt-get update && apt-get install -y \
|
17 |
+
git \
|
18 |
+
&& rm -rf /var/lib/apt/lists/*
|
19 |
+
|
20 |
+
# Install Python dependencies
|
21 |
COPY requirements.txt .
|
22 |
RUN pip install --no-cache-dir -r requirements.txt
|
23 |
|
24 |
+
# ✅ Download required models into cache (CPU-compatible)
|
25 |
+
RUN python -c "from transformers import pipeline; \
|
26 |
+
pipeline('summarization', model='sshleifer/distilbart-cnn-12-6'); \
|
27 |
+
pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english'); \
|
28 |
+
pipeline('text-classification', model='mrm8488/bert-tiny-finetuned-fake-news-detection')"
|
29 |
+
|
30 |
+
# ✅ Download sentence transformer for FAISS
|
31 |
+
RUN python -c "from sentence_transformers import SentenceTransformer; \
|
32 |
+
SentenceTransformer('all-MiniLM-L6-v2')"
|
33 |
+
|
34 |
+
# Copy full app source
|
35 |
COPY . .
|
36 |
|
37 |
+
# Expose Streamlit default port
|
38 |
EXPOSE 7860
|
39 |
|
40 |
+
# Start Streamlit app from src/
|
41 |
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|