rinong commited on
Commit
a39b130
1 Parent(s): cc5a813

Updated visibility change callbacks

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -207,9 +207,12 @@ class ImageEditor(object):
207
 
208
  editor = ImageEditor()
209
 
210
- def change_component_visibility(visible, component, assign_flipped = False):
211
  return component.update(visible=visible)
212
 
 
 
 
213
  blocks = gr.Blocks()
214
 
215
  with blocks:
@@ -241,7 +244,7 @@ with blocks:
241
  for component in [edit_choice, vid_format_choice, vid_output, vid_button]:
242
  video_choice.change(fn=change_component_visibility, inputs=[video_choice, component], outputs=component)
243
  for component in [img_output, img_button]:
244
- video_choice.change(fn=change_component_visibility, inputs=[video_choice, component, True], outputs=component)
245
 
246
  img_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=img_output)
247
  vid_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=vid_output)
 
207
 
208
  editor = ImageEditor()
209
 
210
+ def change_component_visibility(visible, component):
211
  return component.update(visible=visible)
212
 
213
+ def change_component_visibility_flipped(visible, component):
214
+ return component.update(visible=not visible)
215
+
216
  blocks = gr.Blocks()
217
 
218
  with blocks:
 
244
  for component in [edit_choice, vid_format_choice, vid_output, vid_button]:
245
  video_choice.change(fn=change_component_visibility, inputs=[video_choice, component], outputs=component)
246
  for component in [img_output, img_button]:
247
+ video_choice.change(fn=change_component_visibility_flipped, inputs=[video_choice, component], outputs=component)
248
 
249
  img_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=img_output)
250
  vid_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=vid_output)