nzs234 commited on
Commit
eb58ffc
·
verified ·
1 Parent(s): 7f8b3d8

Hotfix2: patch _json_schema_to_python_type for boolean schemas

Browse files
Files changed (1) hide show
  1. app.py +10 -0
app.py CHANGED
@@ -14,6 +14,7 @@ from huggingface_hub import snapshot_download
14
  # Workaround for gradio/gradio_client schema bug on some Spaces runtimes:
15
  # json_schema_to_python_type may pass boolean schema nodes into get_type().
16
  _orig_get_type = gc_utils.get_type
 
17
 
18
 
19
  def _safe_get_type(schema):
@@ -23,6 +24,15 @@ def _safe_get_type(schema):
23
 
24
 
25
  gc_utils.get_type = _safe_get_type
 
 
 
 
 
 
 
 
 
26
 
27
  MODEL_REPO = "nzs234/siglip2-so400m-aesthetic-scorer-v1"
28
  CACHE_DIR = Path("./model_cache")
 
14
  # Workaround for gradio/gradio_client schema bug on some Spaces runtimes:
15
  # json_schema_to_python_type may pass boolean schema nodes into get_type().
16
  _orig_get_type = gc_utils.get_type
17
+ _orig_json_schema_to_python_type = gc_utils._json_schema_to_python_type
18
 
19
 
20
  def _safe_get_type(schema):
 
24
 
25
 
26
  gc_utils.get_type = _safe_get_type
27
+
28
+
29
+ def _safe_json_schema_to_python_type(schema, defs=None):
30
+ if isinstance(schema, bool):
31
+ return "Any"
32
+ return _orig_json_schema_to_python_type(schema, defs)
33
+
34
+
35
+ gc_utils._json_schema_to_python_type = _safe_json_schema_to_python_type
36
 
37
  MODEL_REPO = "nzs234/siglip2-so400m-aesthetic-scorer-v1"
38
  CACHE_DIR = Path("./model_cache")