HadiZayer commited on
Commit
a697bd3
·
1 Parent(s): 674697c

patch gradio_client 5.21.0 bug: bool schema in _json_schema_to_python_type

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -1,5 +1,15 @@
1
  # Copyright 2024 Adobe. All rights reserved.
2
 
 
 
 
 
 
 
 
 
 
 
3
  from huggingface_hub import hf_hub_download
4
  from run_magicfu import MagicFixup
5
  import torchvision
 
1
  # Copyright 2024 Adobe. All rights reserved.
2
 
3
+ # Patch gradio_client 5.21.0 bug: _json_schema_to_python_type receives bool
4
+ # (from "additionalProperties": false in JSON schema) and crashes on "const" in bool
5
+ import gradio_client.utils as _gc_utils
6
+ _orig_schema_to_type = _gc_utils._json_schema_to_python_type
7
+ def _patched_schema_to_type(schema, defs=None):
8
+ if not isinstance(schema, dict):
9
+ return "any"
10
+ return _orig_schema_to_type(schema, defs)
11
+ _gc_utils._json_schema_to_python_type = _patched_schema_to_type
12
+
13
  from huggingface_hub import hf_hub_download
14
  from run_magicfu import MagicFixup
15
  import torchvision