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)