ICGenAIShare05 commited on
Commit
620764b
·
verified ·
1 Parent(s): 70f7694

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +29 -0
  2. requirements.txt +1 -1
app.py CHANGED
@@ -1,3 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  try:
2
  import spaces
3
  IS_SPACES = True
 
1
+ # --- Monkey-patch: fix gradio_client bug where additionalProperties=True (bool) crashes get_type() ---
2
+ try:
3
+ import gradio_client.utils as _gc_utils
4
+
5
+ _original_get_type = _gc_utils.get_type
6
+
7
+ def _patched_get_type(schema):
8
+ if not isinstance(schema, dict):
9
+ return str(type(schema).__name__)
10
+ return _original_get_type(schema)
11
+
12
+ _gc_utils.get_type = _patched_get_type
13
+
14
+ # Also patch _json_schema_to_python_type to guard against non-dict schema
15
+ if hasattr(_gc_utils, "_json_schema_to_python_type"):
16
+ _original_json_schema_to_python_type = _gc_utils._json_schema_to_python_type
17
+
18
+ def _patched_json_schema_to_python_type(schema, defs=None):
19
+ if not isinstance(schema, dict):
20
+ return str(type(schema).__name__)
21
+ return _original_json_schema_to_python_type(schema, defs)
22
+
23
+ _gc_utils._json_schema_to_python_type = _patched_json_schema_to_python_type
24
+
25
+ print("[PATCH] Applied gradio_client get_type monkey-patch for additionalProperties bug")
26
+ except Exception as _patch_err:
27
+ print(f"[WARN] Could not apply gradio_client patch: {_patch_err}")
28
+ # --- End monkey-patch ---
29
+
30
  try:
31
  import spaces
32
  IS_SPACES = True
requirements.txt CHANGED
@@ -4,7 +4,7 @@ accelerate
4
  sentencepiece
5
  pillow
6
  requests
7
- gradio>=5.12.0
8
  huggingface_hub
9
  bitsandbytes
10
  numpy<2.2.0
 
4
  sentencepiece
5
  pillow
6
  requests
7
+ gradio
8
  huggingface_hub
9
  bitsandbytes
10
  numpy<2.2.0