rinong commited on
Commit
62fe8a5
1 Parent(s): bb723df

Updated visibility change callbacks

Browse files
Files changed (1) hide show
  1. app.py +12 -11
app.py CHANGED
@@ -211,7 +211,7 @@ editor = ImageEditor()
211
  def change_component_visibility(component_types, invert_choices):
212
 
213
  def visibility_impl(visible):
214
- return [component_types[idx].update(visible ^ invert_choices[idx]) for idx in range(len(component_types))]
215
 
216
  return visibility_impl
217
 
@@ -226,22 +226,23 @@ with blocks:
226
  "For more information about the paper and code for training your own models (with examples OR text), see below."
227
  )
228
 
229
- with gr.Column():
230
- input_img = gr.inputs.Image(type="filepath", label="Input image")
231
- style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), type="value", label="Choose your styles!")
232
-
233
- with gr.Row():
 
234
  video_choice = gr.inputs.Checkbox(default=False, label="Generate Video?", optional=False)
235
 
236
  edit_choice = gr.inputs.Checkbox(default=False, label="With Editing?", optional=False)
237
  vid_format_choice = gr.inputs.Radio(choices=["gif", "mp4"], type="value", default='mp4', label="Video Format")
238
- with gr.Row():
239
  img_button = gr.Button("Edit Image")
240
- vid_button = gr.Button("Edit Image")
241
 
242
- with gr.Column():
243
- img_output = gr.outputs.Image(type="file")
244
- vid_output = gr.outputs.Video()
245
 
246
  visibility_fn = change_component_visibility(component_types=[gr.Checkbox, gr.Radio, gr.Video, gr.Button, gr.Image, gr.Button],
247
  invert_choices=[False, False, False, False, True, True])
 
211
  def change_component_visibility(component_types, invert_choices):
212
 
213
  def visibility_impl(visible):
214
+ return [component_types[idx].update(visible=visible ^ invert_choices[idx]) for idx in range(len(component_types))]
215
 
216
  return visibility_impl
217
 
 
226
  "For more information about the paper and code for training your own models (with examples OR text), see below."
227
  )
228
 
229
+ with gr.Row():
230
+
231
+ with gr.Column():
232
+ input_img = gr.inputs.Image(type="filepath", label="Input image")
233
+ style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), type="value", label="Choose your styles!")
234
+
235
  video_choice = gr.inputs.Checkbox(default=False, label="Generate Video?", optional=False)
236
 
237
  edit_choice = gr.inputs.Checkbox(default=False, label="With Editing?", optional=False)
238
  vid_format_choice = gr.inputs.Radio(choices=["gif", "mp4"], type="value", default='mp4', label="Video Format")
239
+
240
  img_button = gr.Button("Edit Image")
241
+ vid_button = gr.Button("Generate Video")
242
 
243
+ with gr.Column():
244
+ img_output = gr.outputs.Image(type="file")
245
+ vid_output = gr.outputs.Video()
246
 
247
  visibility_fn = change_component_visibility(component_types=[gr.Checkbox, gr.Radio, gr.Video, gr.Button, gr.Image, gr.Button],
248
  invert_choices=[False, False, False, False, True, True])