# ────────────────────────────────────────────────────────────── # Depth Pro (Apple) — HuggingFace Space (Docker SDK) # CPU-only | transformers>=4.49.0 | zéro dépendance complexe # ────────────────────────────────────────────────────────────── FROM python:3.10-slim ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ HF_HOME=/app/.cache/huggingface WORKDIR /app # 1) Torch CPU-only (évite 2Go de CUDA inutile) RUN pip install --no-cache-dir \ torch==2.3.0+cpu \ torchvision==0.18.0+cpu \ --index-url https://download.pytorch.org/whl/cpu # 2) Reste des dépendances RUN pip install --no-cache-dir \ fastapi==0.111.0 \ "uvicorn[standard]==0.29.0" \ python-multipart==0.0.9 \ transformers==4.49.0 \ numpy==1.26.4 \ Pillow==10.3.0 # 3) Pré-télécharger les poids Depth Pro au build # (~1.3 Go — évite le cold-start à chaque démarrage) RUN python -c "\ from transformers import DepthProImageProcessorFast, DepthProForDepthEstimation; \ print('Téléchargement Depth Pro ...'); \ DepthProImageProcessorFast.from_pretrained('apple/DepthPro-hf'); \ DepthProForDepthEstimation.from_pretrained('apple/DepthPro-hf'); \ print('Poids en cache OK.')" COPY app.py . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]