Spaces:
Sleeping
Sleeping
Fix Codex Extractor interaction compatibility
Browse files
app.py
CHANGED
|
@@ -6,6 +6,7 @@ from pathlib import Path
|
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
import pandas as pd
|
|
|
|
| 9 |
|
| 10 |
from src.totem_workbook import (
|
| 11 |
DEFAULT_WORKBOOK,
|
|
@@ -26,6 +27,24 @@ from src.codex_extractor import process_upload, format_fingerprint_report
|
|
| 26 |
|
| 27 |
ORIGINAL_WORKBOOK_PATH = "data/order69_macmillan_totem_rebuilt.xlsx"
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
CSS = """
|
| 30 |
:root {
|
| 31 |
--studio-green: #0e4a1d;
|
|
|
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
import pandas as pd
|
| 9 |
+
import gradio_client.utils as gradio_client_utils
|
| 10 |
|
| 11 |
from src.totem_workbook import (
|
| 12 |
DEFAULT_WORKBOOK,
|
|
|
|
| 27 |
|
| 28 |
ORIGINAL_WORKBOOK_PATH = "data/order69_macmillan_totem_rebuilt.xlsx"
|
| 29 |
|
| 30 |
+
|
| 31 |
+
def _patch_gradio_schema_bool_compat() -> None:
|
| 32 |
+
"""
|
| 33 |
+
Compatibility shim for Gradio API schema parsing where boolean JSON schema
|
| 34 |
+
nodes can appear as `additionalProperties: true` in newer Pydantic output.
|
| 35 |
+
"""
|
| 36 |
+
original_get_type = gradio_client_utils.get_type
|
| 37 |
+
|
| 38 |
+
def _safe_get_type(schema):
|
| 39 |
+
if isinstance(schema, bool):
|
| 40 |
+
return "boolean"
|
| 41 |
+
return original_get_type(schema)
|
| 42 |
+
|
| 43 |
+
gradio_client_utils.get_type = _safe_get_type
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
_patch_gradio_schema_bool_compat()
|
| 47 |
+
|
| 48 |
CSS = """
|
| 49 |
:root {
|
| 50 |
--studio-green: #0e4a1d;
|