#!/usr/bin/env python """ Lightweight helper to download the COCO FAISS index + caption array into ./scripts/ the first time the Space boots. """ import pathlib, subprocess, sys FILES = { "coco_caption_clip.index": "https://huggingface.co/datasets/stephenebert/coco-faiss-assets/resolve/main/coco_caption_clip.index", "coco_caption_texts.npy": "https://huggingface.co/datasets/stephenebert/coco-faiss-assets/resolve/main/coco_caption_texts.npy", } DEST = pathlib.Path(__file__).resolve().parent def fetch(url, out): cmd = ["curl", "-L", "--progress-bar", "-o", str(out), url] print("⤵️ ", " ".join(cmd), flush=True) subprocess.check_call(cmd) for fname, url in FILES.items(): path = DEST / fname if path.exists(): print(f"✔️ {fname} already present") continue print(f"⬇️ Downloading {fname} …") fetch(url, path) print("✅ All assets ready")