@@ -277,21 +277,15 @@ def trigger_metadata_preview(filepath):
277277 choices = flags .Performance .list (),
278278 value = modules .config .default_performance ,
279279 elem_classes = ['performance_selection' ])
280- with gr .Accordion (label = 'Aspect Ratios' , open = False ) as aspect_ratios_accordion :
280+ with gr .Accordion (label = 'Aspect Ratios' , open = False , elem_id = 'aspect_ratios_accordion' ) as aspect_ratios_accordion :
281281 aspect_ratios_selection = gr .Radio (label = 'Aspect Ratios' , show_label = False ,
282282 choices = modules .config .available_aspect_ratios_labels ,
283283 value = modules .config .default_aspect_ratio ,
284284 info = 'width × height' ,
285285 elem_classes = 'aspect_ratios' )
286286
287- def change_aspect_ratio (text ):
288- import re
289- regex = re .compile ('<.*?>' )
290- cleaned_text = re .sub (regex , '' , text )
291- return gr .update (label = 'Aspect Ratios ' + cleaned_text )
292-
293- aspect_ratios_selection .change (change_aspect_ratio , inputs = aspect_ratios_selection , outputs = aspect_ratios_accordion , queue = False , show_progress = False )
294- shared .gradio_root .load (change_aspect_ratio , inputs = aspect_ratios_selection , outputs = aspect_ratios_accordion , queue = False , show_progress = False )
287+ aspect_ratios_selection .change (lambda x : None , inputs = aspect_ratios_selection , queue = False , show_progress = False , _js = '(x)=>{refresh_aspect_ratios_label(x);}' )
288+ shared .gradio_root .load (lambda x : None , inputs = aspect_ratios_selection , queue = False , show_progress = False , _js = '(x)=>{refresh_aspect_ratios_label(x);}' )
295289
296290 image_number = gr .Slider (label = 'Image Number' , minimum = 1 , maximum = modules .config .default_max_image_number , step = 1 , value = modules .config .default_image_number )
297291
0 commit comments