techfreakworm commited on
Commit
09bd6f1
·
unverified ·
1 Parent(s): 6ad959d

fix(ui): use gr.JSON for metadata output instead of gr.Code

Browse files

gr.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.

Files changed (1) hide show
  1. ui.py +4 -4
ui.py CHANGED
@@ -65,9 +65,9 @@ def build_generate_tab() -> dict[str, gr.components.Component]:
65
  type="filepath",
66
  interactive=False,
67
  )
68
- components["output_meta"] = gr.Code(
69
- label="Metadata",
70
- language="json",
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