FROM python:3.9-slim # Set working directory inside the container WORKDIR /app # Install system dependencies (git is sometimes required by transformers) RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/* # Copy requirements and install them COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy all the FastAPI code into the container COPY . . # Hugging Face Spaces expects the app to run on port 7860 EXPOSE 7860 # Command to run the FastAPI app via Uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]