Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| WORKDIR /app | |
| # Install system dependencies required for some Python packages (e.g. FAISS/Torch) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| COPY requirements.txt . | |
| # Upgrade pip | |
| RUN pip install --no-cache-dir --upgrade pip | |
| # Install CPU-only PyTorch first | |
| RUN pip install --no-cache-dir \ | |
| torch --index-url https://download.pytorch.org/whl/cpu | |
| # Install remaining dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| RUN python -c "from transformers import AutoTokenizer, AutoModelForSeq2SeqLM; AutoTokenizer.from_pretrained('google/flan-t5-base'); AutoModelForSeq2SeqLM.from_pretrained('google/flan-t5-base')" | |
| RUN python -c "from langchain_community.embeddings import HuggingFaceEmbeddings; HuggingFaceEmbeddings(model_name='sentence-transformers/all-MiniLM-L6-v2')" | |
| COPY . . | |
| EXPOSE 7860 | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |