Hiro / sitecustomize.py
Shirosawa's picture
Create sitecustomize.py
1954c40 verified
raw
history blame contribute delete
517 Bytes
# 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 # 提供缺失符号