Spaces:
Running
Running
File size: 1,550 Bytes
95d4877 ceeef4a 95d4877 ceeef4a 95d4877 ceeef4a 95d4877 8a5b056 95d4877 ceeef4a 95d4877 ceeef4a 95d4877 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | # ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
# 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"] |