cobramv12 commited on
Commit
a76cd89
·
verified ·
1 Parent(s): ec87261

Fix: Mechanically disable API info generation to bypass schema bugs

Browse files
Files changed (1) hide show
  1. app.py +9 -16
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import sys
2
  import os
3
 
4
- # --- REPARACIÓN DE EMERGENCIA DE NIVEL SISTEMA ---
5
  # 1. Parche para audioop (Python 3.13)
6
  try:
7
  import audioop
@@ -12,22 +12,15 @@ except ImportError:
12
  except ImportError:
13
  pass
14
 
15
- # 2. Parche para el bug 'bool is not iterable' en Gradio
16
- try:
17
- import gradio_client.utils as client_utils
18
- original_get_type = client_utils.get_type
19
- def patched_get_type(schema):
20
- if isinstance(schema, bool):
21
- return "str"
22
- return original_get_type(schema)
23
- client_utils.get_type = patched_get_type
24
- print("Patch 'gradio_client_bool_bug' aplicado con éxito.")
25
- except Exception as e:
26
- print(f"No se pudo aplicar el parche de Gradio: {e}")
27
  # -------------------------------------------------
28
 
29
  import spaces
30
- import gradio as gr
31
  import torch
32
  import numpy as np
33
  from PIL import Image
@@ -109,5 +102,5 @@ with gr.Blocks(title="Image Utility v2.1") as demo:
109
  v_out = gr.Video(label="Sequence Output")
110
  v_btn.click(generate_video, [v_p, v_img, v_ls], v_out)
111
 
112
- # Forzamos desactivar la API para evitar el bug
113
- demo.launch(show_api=False)
 
1
  import sys
2
  import os
3
 
4
+ # --- ANULACIÓN DE NIVEL SISTEMA (API SILENCER) ---
5
  # 1. Parche para audioop (Python 3.13)
6
  try:
7
  import audioop
 
12
  except ImportError:
13
  pass
14
 
15
+ # 2. ELIMINACIÓN DE LA GENERACIÓN DE API (Corta el error de raíz)
16
+ import gradio as gr
17
+ def fake_get_api_info(self):
18
+ return {"components": {}, "endpoints": {}}
19
+ gr.Blocks.get_api_info = fake_get_api_info
20
+ print("API Documentation generator disabled to prevent schema crashes.")
 
 
 
 
 
 
21
  # -------------------------------------------------
22
 
23
  import spaces
 
24
  import torch
25
  import numpy as np
26
  from PIL import Image
 
102
  v_out = gr.Video(label="Sequence Output")
103
  v_btn.click(generate_video, [v_p, v_img, v_ls], v_out)
104
 
105
+ # Forzamos servidor local para HuggingFace
106
+ demo.launch(server_name="0.0.0.0", server_port=7860, show_api=False)