Spaces:
Configuration error
Configuration error
| # Use a lightweight Python base | |
| FROM python:3.10-slim | |
| # Prevent interactive prompts | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 \ | |
| PYTHONDONTWRITEBYTECODE=1 \ | |
| HF_HOME=/root/.cache/huggingface | |
| # Set work directory | |
| WORKDIR /code | |
| # Install system dependencies (needed for PyTorch + FAISS + SentenceTransformers) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| curl \ | |
| libopenblas-dev \ | |
| libomp-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Install Python dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Pre-download Hugging Face models at build time | |
| RUN python -c "from transformers import pipeline; pipeline('text-generation', model='NousResearch/Nous-Hermes-2-Mistral-7B-DPO')" \ | |
| && python -c "from transformers import pipeline; pipeline('text2text-generation', model='google/flan-t5-large')" \ | |
| && python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2')" | |
| # Copy project files | |
| COPY . . | |
| # Expose port for FastAPI / Hugging Face Spaces | |
| EXPOSE 7860 | |
| # Run FastAPI app with uvicorn | |
| CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] | |