Spaces:
Runtime error
Runtime error
| # Use an official lightweight Python image | |
| FROM python:3.10-slim | |
| # Set environment variables | |
| ENV PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| # Install system dependencies required for OpenCV and other packages | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| build-essential \ | |
| libgl1 \ | |
| libglib2.0-0 \ | |
| git \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set working directory inside the container | |
| WORKDIR /app | |
| # Copy the requirements file and install dependencies | |
| COPY requirements.txt /app/requirements.txt | |
| RUN pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
| # Copy the application code | |
| COPY app.py /app/app.py | |
| # Expose port 7860 (Hugging Face expects the app to run on port 7860) | |
| EXPOSE 7860 | |
| # Start uvicorn server on port 7860 | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |