FROM python:3.10-slim WORKDIR /code # Install minimal system dependencies + GPU support RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender-dev \ libgomp1 \ && rm -rf /var/lib/apt/lists/* # Set environment variables for better performance ENV MPLCONFIGDIR=/tmp/matplotlib ENV PYTHONUNBUFFERED=1 ENV NUMBA_CACHE_DIR=/tmp/numba_cache # Copy requirements and install Python packages COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt RUN mkdir -p /tmp/numba_cache && chmod -R 777 /tmp/numba_cache # Copy application code COPY . . # Expose port 7860 (HF Spaces standard) EXPOSE 7860 # Run the application CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]