umarbalak commited on
Commit
f05aaf5
·
1 Parent(s): 84579b9
Files changed (1) hide show
  1. 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
- # Check if schema is a dict before using 'in' operator
9
- if not isinstance(schema, dict):
10
- return str(schema) # Convert to string as fallback
11
-
12
- # Original logic continues
13
- return original_get_type(schema)
 
 
 
 
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