Spaces:
Running on Zero
Running on Zero
fix(ui): use gr.JSON for metadata output instead of gr.Code
Browse filesgr.Code(language='json') called .strip() on the postprocess value,
expecting a pre-stringified JSON blob. backend.dispatch returns
meta as a Python dict, so passing it directly crashed with
"'dict' object has no attribute 'strip'". gr.JSON accepts the dict
natively and renders it as a syntax-highlighted, expandable tree —
which is closer to what the wireframes show in the Metadata panel
anyway.
Caught while running the live app post-pipeline-fix: the audio file
saved correctly to ./output/<uuid>.wav, but Gradio's output postprocess
crashed on the metadata component.
ui.py
CHANGED
|
@@ -65,9 +65,9 @@ def build_generate_tab() -> dict[str, gr.components.Component]:
|
|
| 65 |
type="filepath",
|
| 66 |
interactive=False,
|
| 67 |
)
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
)
|
| 72 |
|
| 73 |
return components
|
|
|
|
| 65 |
type="filepath",
|
| 66 |
interactive=False,
|
| 67 |
)
|
| 68 |
+
# gr.JSON renders a dict directly as a syntax-highlighted, expandable
|
| 69 |
+
# tree. gr.Code(language="json") refuses dicts — it requires a
|
| 70 |
+
# pre-stringified blob — and crashes with "'dict' has no .strip()".
|
| 71 |
+
components["output_meta"] = gr.JSON(label="Metadata")
|
| 72 |
|
| 73 |
return components
|