# Use an official PyTorch image with CUDA support FROM pytorch/pytorch:2.2.1-cuda12.1-cudnn8-runtime # Hugging Face Spaces require running as a non-root user with ID 1000 RUN useradd -m -u 1000 user USER user # Set environment variables ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 # Set the working directory WORKDIR $HOME/app # Copy requirements and install them COPY --chown=user requirements.txt . RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir -r requirements.txt # Copy the rest of the app files COPY --chown=user . . # Expose the standard Gradio port EXPOSE 7860 # Run the Gradio app CMD ["python", "app.py"]