Spaces:
Paused

Beexly commited on
Commit
325bd56
·
verified ·
1 Parent(s): 4ab8180

Upload folder using huggingface_hub

Browse files
Files changed (3) hide show
  1. __pycache__/app.cpython-311.pyc +0 -0
  2. app.py +21 -0
  3. requirements.txt +0 -1
__pycache__/app.cpython-311.pyc CHANGED
Binary files a/__pycache__/app.cpython-311.pyc and b/__pycache__/app.cpython-311.pyc differ
 
app.py CHANGED
@@ -15,6 +15,27 @@ from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
15
  from kokoro import KPipeline
16
  from f5_tts.api import F5TTS
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  # ---------------------------------------------------------------------------
19
  # Models — loaded once at import time. Under ZeroGPU's patched torch, .to("cuda")
20
  # / device_map="auto" here is deferred (no real GPU touched yet); the ZeroGPU
 
15
  from kokoro import KPipeline
16
  from f5_tts.api import F5TTS
17
 
18
+ # ---------------------------------------------------------------------------
19
+ # Fix a real bug in gradio_client 1.5.2 (bundled with ZeroGPU's forced
20
+ # gradio==5.9.1): its JSON-schema-to-python-type parser assumes every schema
21
+ # node is a dict, but valid JSON Schema allows a bare boolean (e.g.
22
+ # additionalProperties: true) — that crashes EVERY API call to this Space
23
+ # with "TypeError: argument of type 'bool' is not iterable". Patched here,
24
+ # not worked around with an old pydantic pin (which broke docling's own
25
+ # serialization elsewhere) — this is the actual bug.
26
+ import gradio_client.utils as _gc_utils
27
+
28
+ _orig_json_schema_to_python_type = _gc_utils._json_schema_to_python_type
29
+
30
+
31
+ def _patched_json_schema_to_python_type(schema, defs):
32
+ if not isinstance(schema, dict):
33
+ return "bool" if isinstance(schema, bool) else "Any"
34
+ return _orig_json_schema_to_python_type(schema, defs)
35
+
36
+
37
+ _gc_utils._json_schema_to_python_type = _patched_json_schema_to_python_type
38
+
39
  # ---------------------------------------------------------------------------
40
  # Models — loaded once at import time. Under ZeroGPU's patched torch, .to("cuda")
41
  # / device_map="auto" here is deferred (no real GPU touched yet); the ZeroGPU
requirements.txt CHANGED
@@ -1,6 +1,5 @@
1
  spaces
2
  gradio[oauth]==5.9.1
3
- pydantic==2.10.3
4
  diffusers>=0.31.0
5
  transformers>=4.46.0
6
  accelerate>=1.1.0
 
1
  spaces
2
  gradio[oauth]==5.9.1
 
3
  diffusers>=0.31.0
4
  transformers>=4.46.0
5
  accelerate>=1.1.0