Spaces:
Runtime error
Runtime error
Download space_credentials.py from cuiconnect/backend: direct link, hf CLI and curl.
- Browser
- Download file 611 Bytes
-
https://huggingface.co/spaces/cuiconnect/backend/resolve/main/space_credentials.py
- Command line
-
hf download hf://spaces/cuiconnect/backend/space_credentials.py
-
curl -L -o space_credentials.py https://huggingface.co/spaces/cuiconnect/backend/resolve/main/space_credentials.py
611 Bytes
| """ | |
| 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) | |