Spaces:
Sleeping
Sleeping
| # Use a lightweight Python base | |
| FROM python:3.10-slim | |
| # Create a non-root user | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| # Add pip binaries to PATH | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| # Set working directory inside container | |
| WORKDIR / | |
| # Copy requirements and install as non-root user | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
| # Copy project files into container | |
| COPY --chown=user . / | |
| # Run FastAPI app with Uvicorn on port 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |
| # Add this before `CMD` in Dockerfile | |
| RUN python -c "from transformers import pipeline; pipeline('zero-shot-classification', model='joeddav/xlm-roberta-large-xnli')" | |
| RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; AutoTokenizer.from_pretrained('google/flan-t5-base'); AutoModelForSeq2SeqLM.from_pretrained('google/flan-t5-base')" | |