Spaces:
Runtime error
Runtime error
| FROM python:3.12-slim | |
| # Install system dependencies required by OpenCV (cv2) | |
| # libgl1 is required for libGL.so.1 | |
| # libsm6 and libxext6 are commonly needed by imaging libraries in a headless environment. | |
| # libglib2.0-0 is required for libgthread-2.0.so.0 | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| libgl1 \ | |
| libsm6 \ | |
| libxext6 \ | |
| libglib2.0-0 && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container | |
| COPY requirements.txt . | |
| # Install all Python dependencies, including opencv-python, which now finds its system libraries. | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Install gunicorn to run the Flask app | |
| RUN pip install gunicorn | |
| # Copy all application code into the current directory (/app) | |
| COPY . . | |
| # Define the default command to run the application using gunicorn. | |
| # The 'app:app' assumes your Flask app instance is named 'app' inside 'app.py'. | |
| # The port is set to 7860 as required by Hugging Face Spaces. | |
| CMD exec gunicorn --bind :7860 --workers 1 --threads 8 app:app | |