Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import os
|
| 2 |
import gc
|
| 3 |
import cv2
|
| 4 |
-
os.environ["Gradio_SSR"] = "0"
|
| 5 |
|
| 6 |
import gradio as gr
|
| 7 |
import numpy as np
|
|
|
|
| 1 |
+
|
| 2 |
+
# ============================================================
|
| 3 |
+
# PATCH: Fix Gradio bug — gradio_client utils crashes on
|
| 4 |
+
# additionalProperties: false (bool) in JSON Schema on Py 3.13
|
| 5 |
+
# ============================================================
|
| 6 |
+
import gradio_client.utils as _gc_utils
|
| 7 |
+
|
| 8 |
+
def _safe_get_type(schema):
|
| 9 |
+
if not isinstance(schema, dict):
|
| 10 |
+
return "Any"
|
| 11 |
+
return _gc_utils._original_get_type(schema)
|
| 12 |
+
|
| 13 |
+
if not hasattr(_gc_utils, "_original_get_type"):
|
| 14 |
+
_gc_utils._original_get_type = _gc_utils.get_type
|
| 15 |
+
_gc_utils.get_type = _safe_get_type
|
| 16 |
+
|
| 17 |
+
def _safe_json_schema_to_python_type(schema, defs=None):
|
| 18 |
+
if not isinstance(schema, dict):
|
| 19 |
+
return "Any"
|
| 20 |
+
return _gc_utils._original_json_schema_to_python_type(schema, defs)
|
| 21 |
+
|
| 22 |
+
if not hasattr(_gc_utils, "_original_json_schema_to_python_type"):
|
| 23 |
+
_gc_utils._original_json_schema_to_python_type = _gc_utils._json_schema_to_python_type
|
| 24 |
+
_gc_utils._json_schema_to_python_type = _safe_json_schema_to_python_type
|
| 25 |
+
# ============================================================
|
| 26 |
+
|
| 27 |
+
|
| 28 |
import os
|
| 29 |
import gc
|
| 30 |
import cv2
|
|
|
|
| 31 |
|
| 32 |
import gradio as gr
|
| 33 |
import numpy as np
|