Add embedded Hugging Face token fallback

This commit is contained in:
CoolBoy
2026-07-10 01:02:25 +08:00
parent 597d3b1d86
commit 5460fbd108
4 changed files with 10 additions and 6 deletions

View File

@@ -9,7 +9,7 @@ import time
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
from pathlib import Path
from modelhub_submmit_api.defaults import EMBEDDED_MODELHUB_XC_TOKEN
from modelhub_submmit_api.defaults import EMBEDDED_HF_TOKEN, EMBEDDED_MODELHUB_XC_TOKEN
HOST = "0.0.0.0"
@@ -75,7 +75,7 @@ def _worker_command() -> list[str]:
def _config() -> dict[str, object]:
return {
"strategy_id_present": bool(os.getenv("STRATEGY_ID")),
"hf_token_present": bool(os.getenv("HF_TOKEN")),
"hf_token_present": bool(os.getenv("HF_TOKEN") or EMBEDDED_HF_TOKEN),
"modelhub_auth_present": _has_modelhub_auth(),
"config_error": config_error,
"worker_running": worker is not None and worker.poll() is None,