BoxOfColors Claude Sonnet 4.6 commited on
Commit
df3bd13
·
1 Parent(s): f300658

Fix regen: render=False on hidden Textboxes to stop 'Too many arguments' error

Browse files

Gradio's Svelte client throws api_info.ts:423 'Too many arguments provided
for the endpoint' when gr.Textbox(visible=False) components are in the
inputs list — the client counts them as DOM components and rejects the call.

Switching to render=False prevents any DOM element from being created, so
Gradio's internal validation no longer sees them as extra inputs. The JS
fireRegen() still passes values at the correct positional index via the
direct queue/join fetch, which bypasses Svelte validation entirely.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -1777,11 +1777,12 @@ with gr.Blocks(title="Generate Audio for Video", css=_SLOT_CSS, js=_GLOBAL_JS) a
1777
  (taro_slot_grps, taro_slot_vids,
1778
  taro_slot_waves) = _make_output_slots("taro")
1779
 
1780
- # Hidden regen plumbing — gr.Textbox(visible=False) so JS can pass
1781
- # values directly via the queue/join data array (gr.State is server-side
1782
- # and ignores data array values; Textbox is client-side and accepts them).
1783
- taro_regen_seg = gr.Textbox(value="0", visible=False)
1784
- taro_regen_state = gr.Textbox(value="", visible=False)
 
1785
 
1786
  for trigger in [taro_video, taro_steps, taro_cf_dur]:
1787
  trigger.change(
@@ -1886,10 +1887,10 @@ with gr.Blocks(title="Generate Audio for Video", css=_SLOT_CSS, js=_GLOBAL_JS) a
1886
  (mma_slot_grps, mma_slot_vids,
1887
  mma_slot_waves) = _make_output_slots("mma")
1888
 
1889
- # Hidden regen plumbing — gr.Textbox(visible=False) so JS can pass
1890
- # values directly via the queue/join data array.
1891
- mma_regen_seg = gr.Textbox(value="0", visible=False)
1892
- mma_regen_state = gr.Textbox(value="", visible=False)
1893
 
1894
  mma_samples.change(
1895
  fn=_update_slot_visibility,
@@ -1978,10 +1979,10 @@ with gr.Blocks(title="Generate Audio for Video", css=_SLOT_CSS, js=_GLOBAL_JS) a
1978
  (hf_slot_grps, hf_slot_vids,
1979
  hf_slot_waves) = _make_output_slots("hf")
1980
 
1981
- # Hidden regen plumbing — gr.Textbox(visible=False) so JS can pass
1982
- # values directly via the queue/join data array.
1983
- hf_regen_seg = gr.Textbox(value="0", visible=False)
1984
- hf_regen_state = gr.Textbox(value="", visible=False)
1985
 
1986
  hf_samples.change(
1987
  fn=_update_slot_visibility,
 
1777
  (taro_slot_grps, taro_slot_vids,
1778
  taro_slot_waves) = _make_output_slots("taro")
1779
 
1780
+ # Hidden regen plumbing — render=False so no DOM element is created,
1781
+ # avoiding Gradio's "Too many arguments" Svelte validation error.
1782
+ # JS passes values directly via queue/join data array at the correct
1783
+ # positional index (these show up as inputs to the fn but have no DOM).
1784
+ taro_regen_seg = gr.Textbox(value="0", render=False)
1785
+ taro_regen_state = gr.Textbox(value="", render=False)
1786
 
1787
  for trigger in [taro_video, taro_steps, taro_cf_dur]:
1788
  trigger.change(
 
1887
  (mma_slot_grps, mma_slot_vids,
1888
  mma_slot_waves) = _make_output_slots("mma")
1889
 
1890
+ # Hidden regen plumbing — render=False so no DOM element is created,
1891
+ # avoiding Gradio's "Too many arguments" Svelte validation error.
1892
+ mma_regen_seg = gr.Textbox(value="0", render=False)
1893
+ mma_regen_state = gr.Textbox(value="", render=False)
1894
 
1895
  mma_samples.change(
1896
  fn=_update_slot_visibility,
 
1979
  (hf_slot_grps, hf_slot_vids,
1980
  hf_slot_waves) = _make_output_slots("hf")
1981
 
1982
+ # Hidden regen plumbing — render=False so no DOM element is created,
1983
+ # avoiding Gradio's "Too many arguments" Svelte validation error.
1984
+ hf_regen_seg = gr.Textbox(value="0", render=False)
1985
+ hf_regen_state = gr.Textbox(value="", render=False)
1986
 
1987
  hf_samples.change(
1988
  fn=_update_slot_visibility,