FROM python:3.11-slim WORKDIR /app # Install system packages needed for some Python wheels RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ git \ && rm -rf /var/lib/apt/lists/* # Install CPU-only PyTorch first (much smaller than the CUDA version) RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu # Copy and install Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the project files COPY . . # HuggingFace Spaces expects the app on port 7860 EXPOSE 7860 ENV GRADIO_SERVER_NAME=0.0.0.0 ENV GRADIO_SERVER_PORT=7860 CMD ["python", "app.py"]