Fix js parametr in gr.Button.click for Gradio 4.0

fix_fogre_arc_get_image_dim
LEv145 2024-08-22 10:18:18 +02:00 committed by GitHub
parent 1f3553c5a0
commit f06348ad6f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -449,11 +449,17 @@ class AspectRatioScript(scripts.Script):
arc_get_image_dim = ToolButton(
value=IMAGE_DIMENSIONS_SYMBOL
)
if IS_GRADIO_4:
js_parameter = dict(js=current_tab_image)
else:
js_parameter = dict(_js=current_tab_image)
arc_get_image_dim.click(
fn=get_dims,
inputs=self.image,
outputs=[arc_width1, arc_height1],
_js=current_tab_image,
**js_parameter,
)
# Update aspect ratio display on change