Spaces:
Runtime error
Runtime error
| # Use a stable Python base image | |
| FROM python:3.9-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Install system dependencies needed for libraries like OpenCV or Pillow | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file first to leverage Docker's layer caching | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application files into the container | |
| COPY . . | |
| # Create a directory for the generated files | |
| RUN mkdir -p /app/generated | |
| # Expose the port the app will run on | |
| EXPOSE 5000 | |
| # Command to run the application using Gunicorn, a production-grade server | |
| # The timeout is increased because the AI model can take a long time to respond. | |
| CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "1", "--timeout", "300", "app:app"] |