BoxOfColors commited on
Commit
b9a8d80
·
1 Parent(s): 93fa90c

Fix 'Too many arguments': use **_kwargs in duration fns for extra params

Browse files

Gradio introspects the duration callable's signature to determine the
expected input count for @spaces.GPU endpoints. Adding silent_video,
segments_json, total_dur_s as explicit params to _mmaudio_duration and
_hunyuan_duration caused Gradio to register 11/13 expected inputs vs the
9/10 actually wired in .click(inputs=[...]), triggering client-side
'Too many arguments' on every page load.

Fix: absorb the extra kwargs with **_kwargs in both duration functions
so Gradio sees only the 9/10 positional params matching the UI inputs.

Files changed (1) hide show
  1. app.py +7 -4
app.py CHANGED
@@ -1004,8 +1004,10 @@ def generate_taro(video_file, seed_val, cfg_scale, num_steps, mode,
1004
 
1005
  def _mmaudio_duration(video_file, prompt, negative_prompt, seed_val,
1006
  cfg_strength, num_steps, crossfade_s, crossfade_db, num_samples,
1007
- silent_video=None, segments_json=None):
1008
- """Pre-GPU callable — must match _mmaudio_gpu_infer's input order exactly."""
 
 
1009
  return _estimate_gpu_duration("mmaudio", int(num_samples), int(num_steps),
1010
  video_file=video_file, crossfade_s=crossfade_s)
1011
 
@@ -1151,8 +1153,9 @@ def generate_mmaudio(video_file, prompt, negative_prompt, seed_val,
1151
 
1152
  def _hunyuan_duration(video_file, prompt, negative_prompt, seed_val,
1153
  guidance_scale, num_steps, model_size, crossfade_s, crossfade_db,
1154
- num_samples, silent_video=None, segments_json=None, total_dur_s=None):
1155
- """Pre-GPU callable — must match _hunyuan_gpu_infer's input order exactly."""
 
1156
  return _estimate_gpu_duration("hunyuan", int(num_samples), int(num_steps),
1157
  video_file=video_file, crossfade_s=crossfade_s)
1158
 
 
1004
 
1005
  def _mmaudio_duration(video_file, prompt, negative_prompt, seed_val,
1006
  cfg_strength, num_steps, crossfade_s, crossfade_db, num_samples,
1007
+ **_kwargs):
1008
+ """Pre-GPU callable — must match _mmaudio_gpu_infer's input order exactly.
1009
+ Extra kwargs (silent_video, segments_json) are absorbed by **_kwargs so the
1010
+ duration fn signature stays in sync with the 9-input Gradio registration."""
1011
  return _estimate_gpu_duration("mmaudio", int(num_samples), int(num_steps),
1012
  video_file=video_file, crossfade_s=crossfade_s)
1013
 
 
1153
 
1154
  def _hunyuan_duration(video_file, prompt, negative_prompt, seed_val,
1155
  guidance_scale, num_steps, model_size, crossfade_s, crossfade_db,
1156
+ num_samples, **_kwargs):
1157
+ """Pre-GPU callable — must match _hunyuan_gpu_infer's input order exactly.
1158
+ Extra kwargs (silent_video, segments_json, total_dur_s) absorbed by **_kwargs."""
1159
  return _estimate_gpu_duration("hunyuan", int(num_samples), int(num_steps),
1160
  video_file=video_file, crossfade_s=crossfade_s)
1161