Spaces:
Runtime error
Runtime error
Fix: Inject system-level monkeypatch for schema stability
Browse files
app.py
CHANGED
|
@@ -1,7 +1,8 @@
|
|
| 1 |
import sys
|
| 2 |
import os
|
| 3 |
|
| 4 |
-
# ---
|
|
|
|
| 5 |
try:
|
| 6 |
import audioop
|
| 7 |
except ImportError:
|
|
@@ -10,7 +11,20 @@ except ImportError:
|
|
| 10 |
sys.modules["audioop"] = audioop
|
| 11 |
except ImportError:
|
| 12 |
pass
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
import spaces
|
| 16 |
import gradio as gr
|
|
@@ -95,4 +109,5 @@ with gr.Blocks(title="Image Utility v2.1") as demo:
|
|
| 95 |
v_out = gr.Video(label="Sequence Output")
|
| 96 |
v_btn.click(generate_video, [v_p, v_img, v_ls], v_out)
|
| 97 |
|
| 98 |
-
|
|
|
|
|
|
| 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
|
| 8 |
except ImportError:
|
|
|
|
| 11 |
sys.modules["audioop"] = audioop
|
| 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
|
|
|
|
| 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)
|