Mainlst commited on
Commit
97e1ec2
·
1 Parent(s): fb47be6

Hugging Face Space

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py CHANGED
@@ -2,6 +2,24 @@ import tempfile
2
  import time
3
  import os
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  # ZeroGPU / Spaces GPU decorator setup
6
  try:
7
  import spaces
 
2
  import time
3
  import os
4
 
5
+ # --- Monkey patch to fix Gradio schema parsing error ---
6
+ try:
7
+ import gradio_client.utils as client_utils
8
+ if not hasattr(client_utils, "_orig_json_schema_to_python_type"):
9
+ client_utils._orig_json_schema_to_python_type = client_utils._json_schema_to_python_type
10
+
11
+ def _safe_json_schema_to_python_type(schema, defs=None):
12
+ if isinstance(schema, bool):
13
+ return "Any"
14
+ try:
15
+ return client_utils._orig_json_schema_to_python_type(schema, defs)
16
+ except Exception:
17
+ return "Any"
18
+
19
+ client_utils._json_schema_to_python_type = _safe_json_schema_to_python_type
20
+ except ImportError:
21
+ pass
22
+
23
  # ZeroGPU / Spaces GPU decorator setup
24
  try:
25
  import spaces