someone-in-the-world Claude Sonnet 5 commited on
Commit
68273f5
·
1 Parent(s): c8ec0f7

Restore the .change() type: ignore removed during the develop merge

Browse files

mypy without gradio installed treats it as untyped Any (ignore_missing_imports),
which made the ignore comment look unused locally. CI installs gradio for real,
where the base Component type genuinely lacks .change(), so the suppression is
required there.

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

Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -509,7 +509,11 @@ with gr.Blocks() as demo:
509
 
510
  preview_inputs = [input_image_component, duration_input, frame_multiplier_input, upscale_checkbox]
511
  for component in preview_inputs:
512
- component.change(fn=preview_effect, inputs=preview_inputs, outputs=effect_preview)
 
 
 
 
513
  demo.load(fn=preview_effect, inputs=preview_inputs, outputs=effect_preview)
514
 
515
  if __name__ == "__main__":
 
509
 
510
  preview_inputs = [input_image_component, duration_input, frame_multiplier_input, upscale_checkbox]
511
  for component in preview_inputs:
512
+ # `component` collapses to the base Component type across this mixed list, and gradio's
513
+ # stubs only declare .change on the concrete subclasses, not the base.
514
+ component.change( # type: ignore[attr-defined]
515
+ fn=preview_effect, inputs=preview_inputs, outputs=effect_preview
516
+ )
517
  demo.load(fn=preview_effect, inputs=preview_inputs, outputs=effect_preview)
518
 
519
  if __name__ == "__main__":