Spaces:
Sleeping
Sleeping
Commit ·
b5d447a
1
Parent(s): 9cc906d
gradio fix
Browse files6 unmodified lines78910111213141516171819202122236 unmodified linesimport tracebackfrom validation import validate_json, validate_croissant, validate_records, validate_rai, generate_validation_report# Patch gradio_client.utils.get_type to handle boolean JSON schemas.# gradio_client 1.7.2 crashes with "argument of type 'bool' is not iterable"# when a component's JSON schema has `additionalProperties: true/false`.# show_api=False in launch() doesn't remove the /info route in Gradio 5.20,# so this patch is needed to prevent the crash on every request._orig_get_type = _gc_utils.get_typedef _safe_get_type(schema):if not isinstance(schema, dict):return "any"return _orig_get_type(schema)_gc_utils.get_type = _safe_get_typedef process_file(file):results = []6 unmodified lines78910111213141516171819202122236 unmodified linesimport tracebackfrom validation import validate_json, validate_croissant, validate_records, validate_rai, generate_validation_report# Patch gradio_client.utils to handle boolean JSON schemas.# gradio_client 1.7.2 crashes when a component schema has `additionalProperties: true/false`.# The inner recursive function _json_schema_to_python_type receives True/False and either# raises TypeError ("argument of type 'bool' is not iterable") or APIInfoParseError.# Patching the inner function is the correct fix since it's called recursively._orig_json_schema_to_python_type = _gc_utils._json_schema_to_python_typedef _safe_json_schema_to_python_type(schema, defs=None):if not isinstance(schema, dict):return "any"return _orig_json_schema_to_python_type(schema, defs)_gc_utils._json_schema_to_python_type = _safe_json_schema_to_python_typedef process_file(file):results = []
app.py+9-9