Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,5 +1,21 @@
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
|
| 4 |
from qwen_vl_utils import process_vision_info
|
| 5 |
import torch
|
|
|
|
| 1 |
import os
|
| 2 |
import gradio as gr
|
| 3 |
+
|
| 4 |
+
# --- Patch gradio_client boolean-schema bug ---
|
| 5 |
+
import gradio_client.utils as gcu
|
| 6 |
+
|
| 7 |
+
orig_json_schema_to_python_type = gcu._json_schema_to_python_type
|
| 8 |
+
|
| 9 |
+
def _safe_json_schema_to_python_type(schema, defs):
|
| 10 |
+
# Fix: handle boolean schema values for additionalProperties
|
| 11 |
+
if isinstance(schema, bool):
|
| 12 |
+
# True → any type allowed; False → never allowed
|
| 13 |
+
return "Any" if schema else "Never"
|
| 14 |
+
return orig_json_schema_to_python_type(schema, defs)
|
| 15 |
+
|
| 16 |
+
gcu._json_schema_to_python_type = _safe_json_schema_to_python_type
|
| 17 |
+
# ------------------------------------------------
|
| 18 |
+
|
| 19 |
from transformers import Qwen2VLForConditionalGeneration, AutoProcessor
|
| 20 |
from qwen_vl_utils import process_vision_info
|
| 21 |
import torch
|