# Use an official Python runtime as a parent image FROM python:3.9-slim # Set the working directory in the container WORKDIR /app # Install system dependencies required by OpenCV and Albumentations RUN apt-get update && apt-get install -y \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* # Copy the requirements file into the container COPY requirements.txt . # Install any needed packages specified in requirements.txt # Using --no-cache-dir to keep the image size small RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application COPY . . # Hugging Face Spaces require the app to run on port 7860 EXPOSE 7860 # Run uvicorn server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]