Spaces:
Sleeping
Sleeping
Fix: add HfFolder compatibility shim for huggingface_hub >= 0.30
Browse files
app.py
CHANGED
|
@@ -16,6 +16,20 @@ Models used (all from Hugging Face):
|
|
| 16 |
"""
|
| 17 |
|
| 18 |
import os
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
import gradio as gr
|
| 20 |
import numpy as np
|
| 21 |
import pandas as pd
|
|
|
|
| 16 |
"""
|
| 17 |
|
| 18 |
import os
|
| 19 |
+
|
| 20 |
+
# ── Compatibility shim: huggingface_hub >= 0.30 removed HfFolder ──
|
| 21 |
+
import huggingface_hub as _hfh
|
| 22 |
+
if not hasattr(_hfh, "HfFolder"):
|
| 23 |
+
class _HfFolder:
|
| 24 |
+
@staticmethod
|
| 25 |
+
def get_token():
|
| 26 |
+
return _hfh.get_token()
|
| 27 |
+
@staticmethod
|
| 28 |
+
def save_token(token):
|
| 29 |
+
_hfh.login(token=token)
|
| 30 |
+
_hfh.HfFolder = _HfFolder
|
| 31 |
+
# ───────────────────────────────────────────────────────────────────
|
| 32 |
+
|
| 33 |
import gradio as gr
|
| 34 |
import numpy as np
|
| 35 |
import pandas as pd
|