File size: 523 Bytes
4745480 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | import os
oauth_file = "/usr/local/lib/python3.12/site-packages/gradio/oauth.py"
with open(oauth_file, 'r') as f:
content = f.read()
# Replace the problematic import
patch = """
try:
from huggingface_hub import HfFolder, whoami
except ImportError:
class HfFolder:
@staticmethod
def get_token(): return None
def whoami(): return {}
"""
new_content = content.replace("from huggingface_hub import HfFolder, whoami", patch.strip())
with open(oauth_file, 'w') as f:
f.write(new_content)
|