Spaces:
Runtime error
Runtime error
| FROM python:3.9-slim | |
| # Set working directory | |
| WORKDIR /app | |
| # Avoid Hugging Face permission warnings and force CPU | |
| ENV HF_HOME=/app/.cache/huggingface | |
| ENV TRANSFORMERS_CACHE=$HF_HOME | |
| ENV HF_DATASETS_CACHE=$HF_HOME/datasets | |
| ENV HF_METRICS_CACHE=$HF_HOME/metrics | |
| # Create and set permission to the cache folder | |
| RUN mkdir -p $HF_HOME && chmod -R 777 $HF_HOME | |
| # Install system dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # β Download required models into cache (CPU-compatible) | |
| RUN python -c "from transformers import pipeline; \ | |
| pipeline('summarization', model='sshleifer/distilbart-cnn-12-6'); \ | |
| pipeline('sentiment-analysis', model='distilbert-base-uncased-finetuned-sst-2-english'); \ | |
| pipeline('text-classification', model='mrm8488/bert-tiny-finetuned-fake-news-detection')" | |
| # β Download sentence transformer for FAISS | |
| RUN python -c "from sentence_transformers import SentenceTransformer; \ | |
| SentenceTransformer('all-MiniLM-L6-v2')" | |
| # Copy full app source | |
| COPY . . | |
| # Expose Streamlit default port | |
| EXPOSE 7860 | |
| # Start Streamlit app from src/ | |
| CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"] | |