Spaces:
Runtime error
Runtime error
Updated visibility change callbacks
Browse files
app.py
CHANGED
@@ -207,10 +207,8 @@ class ImageEditor(object):
|
|
207 |
|
208 |
editor = ImageEditor()
|
209 |
|
210 |
-
def change_component_visibility(visible,
|
211 |
-
|
212 |
-
return [component.update(visible=not visible) for component in components]
|
213 |
-
return [component.update(visible=visible) for component in components]
|
214 |
|
215 |
blocks = gr.Blocks()
|
216 |
|
@@ -240,8 +238,10 @@ with blocks:
|
|
240 |
img_output = gr.outputs.Image(type="file")
|
241 |
vid_output = gr.outputs.Video()
|
242 |
|
243 |
-
|
244 |
-
|
|
|
|
|
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, assign_flipped = False):
|
211 |
+
return component.update(visible=visible)
|
|
|
|
|
212 |
|
213 |
blocks = gr.Blocks()
|
214 |
|
|
|
238 |
img_output = gr.outputs.Image(type="file")
|
239 |
vid_output = gr.outputs.Video()
|
240 |
|
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)
|