Spaces:
Runtime error
Runtime error
File size: 611 Bytes
a77098c 8299bad a77098c 8299bad a77098c 8299bad a77098c | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | """
Hugging Face Hub auth for model downloads (embeddings, etc.).
Do not put real tokens in this repo — HF blocks pushes that contain secrets.
For the Space: Settings → Variables and secrets → add secret name `HF_TOKEN`
(value = a read token from https://huggingface.co/settings/tokens).
This module mirrors that secret into env vars the Hugging Face libraries expect.
No .env file is required.
"""
import os
_token = (os.environ.get("HF_TOKEN") or "").strip()
if _token:
for _key in ("HF_TOKEN", "HUGGING_FACE_HUB_TOKEN", "HUGGINGFACEHUB_API_TOKEN"):
os.environ.setdefault(_key, _token)
|