BoxOfColors commited on
Commit
3b9db74
·
1 Parent(s): dba6c4f

Fix regen: replace gr.State with gr.Textbox(visible=False) for regen plumbing

Browse files

gr.State stores values server-side and ignores data passed via queue/join API.
gr.Textbox(visible=False) is client-side and correctly receives seg_idx and
state_json from the JS direct queue API call.

Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -1772,9 +1772,11 @@ with gr.Blocks(title="Generate Audio for Video", css=_SLOT_CSS, js=_GLOBAL_JS) a
1772
  (taro_slot_grps, taro_slot_vids,
1773
  taro_slot_waves) = _make_output_slots("taro")
1774
 
1775
- # Hidden regen plumbing — gr.State has zero DOM footprint
1776
- taro_regen_seg = gr.State(value="0")
1777
- taro_regen_state = gr.State(value="")
 
 
1778
 
1779
  for trigger in [taro_video, taro_steps, taro_cf_dur]:
1780
  trigger.change(
@@ -1879,9 +1881,10 @@ with gr.Blocks(title="Generate Audio for Video", css=_SLOT_CSS, js=_GLOBAL_JS) a
1879
  (mma_slot_grps, mma_slot_vids,
1880
  mma_slot_waves) = _make_output_slots("mma")
1881
 
1882
- # Hidden regen plumbing — gr.State has zero DOM footprint
1883
- mma_regen_seg = gr.State(value="0")
1884
- mma_regen_state = gr.State(value="")
 
1885
 
1886
  mma_samples.change(
1887
  fn=_update_slot_visibility,
@@ -1970,9 +1973,10 @@ with gr.Blocks(title="Generate Audio for Video", css=_SLOT_CSS, js=_GLOBAL_JS) a
1970
  (hf_slot_grps, hf_slot_vids,
1971
  hf_slot_waves) = _make_output_slots("hf")
1972
 
1973
- # Hidden regen plumbing — gr.State has zero DOM footprint
1974
- hf_regen_seg = gr.State(value="0")
1975
- hf_regen_state = gr.State(value="")
 
1976
 
1977
  hf_samples.change(
1978
  fn=_update_slot_visibility,
 
1772
  (taro_slot_grps, taro_slot_vids,
1773
  taro_slot_waves) = _make_output_slots("taro")
1774
 
1775
+ # Hidden regen plumbing — gr.Textbox(visible=False) so JS can pass
1776
+ # values directly via the queue/join data array (gr.State is server-side
1777
+ # and ignores data array values; Textbox is client-side and accepts them).
1778
+ taro_regen_seg = gr.Textbox(value="0", visible=False)
1779
+ taro_regen_state = gr.Textbox(value="", visible=False)
1780
 
1781
  for trigger in [taro_video, taro_steps, taro_cf_dur]:
1782
  trigger.change(
 
1881
  (mma_slot_grps, mma_slot_vids,
1882
  mma_slot_waves) = _make_output_slots("mma")
1883
 
1884
+ # Hidden regen plumbing — gr.Textbox(visible=False) so JS can pass
1885
+ # values directly via the queue/join data array.
1886
+ mma_regen_seg = gr.Textbox(value="0", visible=False)
1887
+ mma_regen_state = gr.Textbox(value="", visible=False)
1888
 
1889
  mma_samples.change(
1890
  fn=_update_slot_visibility,
 
1973
  (hf_slot_grps, hf_slot_vids,
1974
  hf_slot_waves) = _make_output_slots("hf")
1975
 
1976
+ # Hidden regen plumbing — gr.Textbox(visible=False) so JS can pass
1977
+ # values directly via the queue/join data array.
1978
+ hf_regen_seg = gr.Textbox(value="0", visible=False)
1979
+ hf_regen_state = gr.Textbox(value="", visible=False)
1980
 
1981
  hf_samples.change(
1982
  fn=_update_slot_visibility,