FROM python:3.10-slim WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ git ffmpeg libsm6 libxext6 \ && rm -rf /var/lib/apt/lists/* # Ensure numpy compatibility RUN pip install --no-cache-dir "numpy<2.0" # ✅ Install safe PyTorch CPU version (2.6.0 works fine for Spaces) RUN pip install --no-cache-dir torch==2.6.0 torchvision==0.21.0 torchaudio==2.6.0 # Copy project files COPY . /app # ✅ Install your app dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir fastapi uvicorn transformers pillow langchain langsmith python-multipart # Use /tmp as Hugging Face cache (prevents write permission issues) ENV HF_HOME=/tmp/huggingface_cache # Expose Hugging Face default port EXPOSE 7860 # ✅ Start FastAPI CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]