update
Browse files- patch_gradio.py +10 -6
patch_gradio.py
CHANGED
|
@@ -5,12 +5,16 @@ original_get_type = gradio_client.utils.get_type
|
|
| 5 |
|
| 6 |
# Define the patched function
|
| 7 |
def patched_get_type(schema):
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
# Apply the patch
|
| 16 |
gradio_client.utils.get_type = patched_get_type
|
|
|
|
| 5 |
|
| 6 |
# Define the patched function
|
| 7 |
def patched_get_type(schema):
|
| 8 |
+
try:
|
| 9 |
+
# Check if schema is a dict before using 'in' operator
|
| 10 |
+
if not isinstance(schema, dict):
|
| 11 |
+
return str(schema) # Convert to string as fallback
|
| 12 |
+
|
| 13 |
+
# Original logic continues
|
| 14 |
+
return original_get_type(schema)
|
| 15 |
+
except Exception as e:
|
| 16 |
+
print(f"Error parsing schema: {schema}, Error: {e}")
|
| 17 |
+
return "unknown" # Return a default type for invalid schemas
|
| 18 |
|
| 19 |
# Apply the patch
|
| 20 |
gradio_client.utils.get_type = patched_get_type
|