From 9814d3d0ae6aa3a478ebdd08246eac76fac8cf15 Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:20:37 -0800 Subject: [PATCH] Patch gradio 4.x for huggingface-hub 1.x compatibility --- server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.py b/server.py index d8fb2c22..e98ff153 100644 --- a/server.py +++ b/server.py @@ -3,6 +3,11 @@ import shutil import warnings from pathlib import Path +# Monkey-patch HfFolder for gradio 4.x compatibility with huggingface-hub 1.x +import huggingface_hub +if not hasattr(huggingface_hub, 'HfFolder'): + huggingface_hub.HfFolder = type('HfFolder', (), {'get_token': staticmethod(huggingface_hub.get_token)}) + from modules import shared from modules.block_requests import OpenMonkeyPatch, RequestBlocker from modules.image_models import load_image_model