Spaces:
Running on Zero
Running on Zero
Add HF_TOKEN auth for private model repo access
Browse filesLogin to HuggingFace Hub using HF_TOKEN env var (set as Space secret).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- backend/appfunc.py +5 -1
backend/appfunc.py
CHANGED
|
@@ -4,7 +4,11 @@ import traceback
|
|
| 4 |
import gradio as gr
|
| 5 |
import os.path as osp
|
| 6 |
|
| 7 |
-
from huggingface_hub import hf_hub_download, list_repo_files
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
from omegaconf import OmegaConf
|
| 10 |
from refnet.util import instantiate_from_config
|
|
|
|
| 4 |
import gradio as gr
|
| 5 |
import os.path as osp
|
| 6 |
|
| 7 |
+
from huggingface_hub import hf_hub_download, list_repo_files, login
|
| 8 |
+
|
| 9 |
+
HF_TOKEN = os.environ.get("HF_TOKEN", None)
|
| 10 |
+
if HF_TOKEN:
|
| 11 |
+
login(token=HF_TOKEN)
|
| 12 |
|
| 13 |
from omegaconf import OmegaConf
|
| 14 |
from refnet.util import instantiate_from_config
|