FROM python:3.11-slim WORKDIR /app ENV HF_HOME=/app/hf-cache \ PYTHONUNBUFFERED=1 COPY requirements.txt . RUN pip install --no-cache-dir torch --index-url https://download.pytorch.org/whl/cpu \ && pip install --no-cache-dir -r requirements.txt # Bake BOTH switchable CLIP models into the image (Space disk is non-persistent at runtime). RUN python - <<'PY' from transformers import CLIPVisionModelWithProjection, CLIPImageProcessor for mid in ("openai/clip-vit-base-patch32", "openai/clip-vit-large-patch14", "geolocal/StreetCLIP"): CLIPVisionModelWithProjection.from_pretrained(mid) CLIPImageProcessor.from_pretrained(mid) PY COPY . . EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--workers", "1"]