FROM python:3.9-slim # Actualiza e instala dependencias RUN apt-get update && apt-get install -y \ libglib2.0-0 \ libsm6 \ libxext6 \ libxrender1 \ libgl1-mesa-glx \ && rm -rf /var/lib/apt/lists/* # Configura directorios temporales ENV YOLO_CONFIG_DIR=/tmp/yolo_config ENV MPLCONFIGDIR=/tmp/matplotlib ENV ULTRALYTICS_HOME=/tmp/ultralytics # Crea directorios necesarios RUN mkdir -p /tmp/yolo_config /tmp/matplotlib /tmp/ultralytics && \ chmod -R 777 /tmp/yolo_config /tmp/matplotlib /tmp/ultralytics WORKDIR /app # Instala dependencias COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copia el código COPY . . # Puerto para Hugging Face Spaces EXPOSE 7860 # Comando para ejecutar CMD ["gunicorn", "--timeout", "300", "--workers", "1", "--bind", "0.0.0.0:7860", "app:app"]