File size: 936 Bytes
493d9a8 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# Patch for Gradio's 'bool' is not iterable error
import sys
def patch_gradio():
try:
import gradio_client.utils
# Store the original get_type function
original_get_type = gradio_client.utils.get_type
# Create a fixed version that handles booleans
def patched_get_type(schema):
if isinstance(schema, bool):
return "bool"
return original_get_type(schema)
# Replace the original function with our patched version
gradio_client.utils.get_type = patched_get_type
print("✅ Gradio patch applied successfully")
except ImportError:
print("❌ Could not import gradio_client.utils to apply patch")
except Exception as e:
print(f"❌ Failed to apply Gradio patch: {str(e)}")
# Apply the patch immediately when this module is imported
patch_gradio() |