github-actions[bot] commited on
Commit
182ae9b
·
1 Parent(s): 960e045

Deploy from GitHub - 2026-01-21 07:26:39

Browse files
Files changed (1) hide show
  1. app.py +20 -1
app.py CHANGED
@@ -24,6 +24,7 @@ import gradio_client.utils as _real_client_utils
24
 
25
  # Save the original get_type function
26
  _original_get_type = _real_client_utils.get_type
 
27
 
28
  def _patched_get_type(schema):
29
  """Patched version that handles when schema is a bool (False means "any type")"""
@@ -33,8 +34,26 @@ def _patched_get_type(schema):
33
  # Call original for everything else
34
  return _original_get_type(schema)
35
 
36
- # Replace the function
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  _real_client_utils.get_type = _patched_get_type
 
38
 
39
  # Now safe to import gradio
40
  import gradio as gr
 
24
 
25
  # Save the original get_type function
26
  _original_get_type = _real_client_utils.get_type
27
+ _original_json_schema_to_python_type = _real_client_utils.json_schema_to_python_type
28
 
29
  def _patched_get_type(schema):
30
  """Patched version that handles when schema is a bool (False means "any type")"""
 
34
  # Call original for everything else
35
  return _original_get_type(schema)
36
 
37
+ def _patched_json_schema_to_python_type(schema, defs=None):
38
+ """Patched version that handles bool schemas at the top level"""
39
+ # Handle boolean schemas (True = any, False = none)
40
+ if isinstance(schema, bool):
41
+ if not schema: # False means empty/no schema
42
+ return "Any"
43
+ return "Any" # True also means any type in JSON schema
44
+ # Handle the case where schema is None
45
+ if schema is None:
46
+ return "Any"
47
+ # Call original for everything else
48
+ try:
49
+ return _original_json_schema_to_python_type(schema, defs)
50
+ except Exception:
51
+ # If original fails, return Any as fallback
52
+ return "Any"
53
+
54
+ # Replace the functions
55
  _real_client_utils.get_type = _patched_get_type
56
+ _real_client_utils.json_schema_to_python_type = _patched_json_schema_to_python_type
57
 
58
  # Now safe to import gradio
59
  import gradio as gr