fix
Browse files
app.py
CHANGED
|
@@ -5,6 +5,21 @@ from __future__ import annotations
|
|
| 5 |
import tempfile
|
| 6 |
from typing import Any, Dict, Iterable, List, Optional, Tuple
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
import gradio as gr
|
| 9 |
import pandas as pd
|
| 10 |
import matplotlib.figure as mpl_fig
|
|
|
|
| 5 |
import tempfile
|
| 6 |
from typing import Any, Dict, Iterable, List, Optional, Tuple
|
| 7 |
|
| 8 |
+
# Monkey-patch to fix gradio_client TypeError bug with boolean additionalProperties
|
| 9 |
+
# This must be done BEFORE importing gradio
|
| 10 |
+
import gradio_client.utils as _gc_utils
|
| 11 |
+
|
| 12 |
+
_original_json_schema_to_python_type = _gc_utils._json_schema_to_python_type
|
| 13 |
+
|
| 14 |
+
def _patched_json_schema_to_python_type(schema, defs=None):
|
| 15 |
+
"""Patched version that handles boolean schema values."""
|
| 16 |
+
# Handle boolean schemas (e.g., additionalProperties: true/false)
|
| 17 |
+
if isinstance(schema, bool):
|
| 18 |
+
return "Any" if schema else "None"
|
| 19 |
+
return _original_json_schema_to_python_type(schema, defs)
|
| 20 |
+
|
| 21 |
+
_gc_utils._json_schema_to_python_type = _patched_json_schema_to_python_type
|
| 22 |
+
|
| 23 |
import gradio as gr
|
| 24 |
import pandas as pd
|
| 25 |
import matplotlib.figure as mpl_fig
|