Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -30,7 +30,8 @@ import copy
|
|
| 30 |
|
| 31 |
_original_parser = gc_utils._json_schema_to_python_type
|
| 32 |
|
| 33 |
-
|
|
|
|
| 34 |
try:
|
| 35 |
# Deepcopy to avoid mutating the original schema object
|
| 36 |
safe_schema = copy.deepcopy(schema)
|
|
@@ -47,10 +48,11 @@ def _patched_parser(schema):
|
|
| 47 |
fix_booleans(item)
|
| 48 |
|
| 49 |
fix_booleans(safe_schema)
|
| 50 |
-
|
|
|
|
| 51 |
except Exception:
|
| 52 |
# Fallback to the original schema if our scrubber fails
|
| 53 |
-
return _original_parser(schema)
|
| 54 |
|
| 55 |
gc_utils._json_schema_to_python_type = _patched_parser
|
| 56 |
|
|
|
|
| 30 |
|
| 31 |
_original_parser = gc_utils._json_schema_to_python_type
|
| 32 |
|
| 33 |
+
# Updated to accept *args and **kwargs to handle newer Gradio version signatures safely
|
| 34 |
+
def _patched_parser(schema, *args, **kwargs):
|
| 35 |
try:
|
| 36 |
# Deepcopy to avoid mutating the original schema object
|
| 37 |
safe_schema = copy.deepcopy(schema)
|
|
|
|
| 48 |
fix_booleans(item)
|
| 49 |
|
| 50 |
fix_booleans(safe_schema)
|
| 51 |
+
# Pass the safe schema along with any other arguments (like `defs`)
|
| 52 |
+
return _original_parser(safe_schema, *args, **kwargs)
|
| 53 |
except Exception:
|
| 54 |
# Fallback to the original schema if our scrubber fails
|
| 55 |
+
return _original_parser(schema, *args, **kwargs)
|
| 56 |
|
| 57 |
gc_utils._json_schema_to_python_type = _patched_parser
|
| 58 |
|