Spaces:
Sleeping
Sleeping
| # Use the official Python image with a version compatible with torch and gradio | |
| FROM python:3.11-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| HF_HOME=/app/hf_cache | |
| # Set work directory | |
| WORKDIR /app | |
| # Install system dependencies | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| git \ | |
| libglib2.0-0 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libxrender-dev \ | |
| ffmpeg \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements | |
| COPY requirements.txt ./ | |
| # Install Python dependencies | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the code | |
| COPY . . | |
| # Expose port for Gradio | |
| EXPOSE 7860 | |
| # Set Gradio to listen on all interfaces (required for Spaces) | |
| ENV GRADIO_SERVER_NAME=0.0.0.0 | |
| # Run the app | |
| CMD ["python", "app.py"] | |