rinong commited on
Commit
cbac29e
β€’
1 Parent(s): 1edbcae

Layout changes, fixed inversion input

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +14 -12
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: πŸŒ–
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.0b6
8
  app_file: app.py
9
  pinned: false
10
  license: mit
 
4
  colorFrom: blue
5
  colorTo: gray
6
  sdk: gradio
7
+ sdk_version: 3.0b8
8
  app_file: app.py
9
  pinned: false
10
  license: mit
app.py CHANGED
@@ -129,7 +129,7 @@ class ImageEditor(object):
129
  return style_list
130
 
131
  def invert_image(self, input_image):
132
- input_image = self.run_alignment(str(input))
133
 
134
  input_image = input_image.resize(self.resize_dims)
135
 
@@ -161,6 +161,7 @@ class ImageEditor(object):
161
  with_editing, # Apply latent space editing to the generated video
162
  video_format # Choose gif to display in browser, mp4 for higher-quality downloadable video
163
  ):
 
164
  # @title Align image
165
  out_dir = Path(tempfile.mkdtemp())
166
  out_path = out_dir / "out.jpg"
@@ -274,24 +275,25 @@ with blocks:
274
  # img_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=img_output)
275
  # vid_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=vid_output)
276
 
277
- input_img = gr.inputs.Image(type="filepath", label="Input image")
278
-
279
  with gr.Row():
 
280
  style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), type="value", label="Choose your styles!")
281
 
282
  with gr.Tabs():
283
  with gr.TabItem("Edit Images"):
284
- with gr.Row():
285
- img_button = gr.Button("Edit Image")
286
- img_output = gr.outputs.Image(type="file")
 
287
 
288
  with gr.TabItem("Create Video"):
289
- with gr.Row():
290
- edit_choice = gr.inputs.Checkbox(default=False, label="With latent space editing?", optional=False)
291
- vid_format_choice = gr.inputs.Radio(choices=["gif", "mp4"], type="value", default='mp4', label="Video Format")
292
-
293
- with gr.Row():
294
- vid_button = gr.Button("Generate Video")
 
295
  vid_output = gr.outputs.Video()
296
 
297
  img_button.click(fn=editor.edit_image, inputs=[input_img, style_choice], outputs=img_output)
 
129
  return style_list
130
 
131
  def invert_image(self, input_image):
132
+ input_image = self.run_alignment(str(input_image))
133
 
134
  input_image = input_image.resize(self.resize_dims)
135
 
 
161
  with_editing, # Apply latent space editing to the generated video
162
  video_format # Choose gif to display in browser, mp4 for higher-quality downloadable video
163
  ):
164
+
165
  # @title Align image
166
  out_dir = Path(tempfile.mkdtemp())
167
  out_path = out_dir / "out.jpg"
 
275
  # img_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=img_output)
276
  # vid_button.click(fn=editor.predict, inputs=[input_img, style_choice, video_choice, edit_choice, vid_format_choice], outputs=vid_output)
277
 
 
 
278
  with gr.Row():
279
+ input_img = gr.inputs.Image(type="filepath", label="Input image")
280
  style_choice = gr.inputs.CheckboxGroup(choices=editor.get_style_list(), type="value", label="Choose your styles!")
281
 
282
  with gr.Tabs():
283
  with gr.TabItem("Edit Images"):
284
+ with gr.Column():
285
+ img_button = gr.Button("Edit Image")
286
+ with gr.Column():
287
+ img_output = gr.outputs.Image(type="file")
288
 
289
  with gr.TabItem("Create Video"):
290
+ with gr.Column():
291
+ with gr.Row():
292
+ edit_choice = gr.inputs.Checkbox(default=False, label="With latent space editing?", optional=False)
293
+ vid_format_choice = gr.inputs.Radio(choices=["gif", "mp4"], type="value", default='mp4', label="Video Format")
294
+ vid_button = gr.Button("Generate Video")
295
+
296
+ with gr.Column():
297
  vid_output = gr.outputs.Video()
298
 
299
  img_button.click(fn=editor.edit_image, inputs=[input_img, style_choice], outputs=img_output)