# sitecustomize.py — shim for old libs importing huggingface_hub.HfFolder import os, types import huggingface_hub as _hh if not hasattr(_hh, "HfFolder"): class _ShimHfFolder: @staticmethod def get_token(): # Spaces 内用 Secrets: HF_TOKEN return os.getenv("HF_TOKEN", "") @staticmethod def save_token(token: str): # 在 Spaces 环境不落盘,直接忽略 return None _hh.HfFolder = _ShimHfFolder # 提供缺失符号