File size: 517 Bytes
1954c40 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# 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 # 提供缺失符号
|