Spaces:
Runtime error
Runtime error
Cast paths to str
Browse files
app.py
CHANGED
@@ -179,7 +179,7 @@ class ImageEditor(object):
|
|
179 |
out_img = torch.cat(img_list, axis=0)
|
180 |
utils.save_image(out_img, out_path, nrow=int(np.sqrt(out_img.size(0))), normalize=True, scale_each=True, range=(-1, 1))
|
181 |
|
182 |
-
return
|
183 |
|
184 |
return self.generate_vid(generators, inverted_latent, out_dir, video_format, with_editing)
|
185 |
|
@@ -206,7 +206,7 @@ class ImageEditor(object):
|
|
206 |
else:
|
207 |
shutil.copy2(gen_path, out_path)
|
208 |
|
209 |
-
return out_path
|
210 |
|
211 |
def run_alignment(self, image_path):
|
212 |
aligned_image = align_face(filepath=image_path, predictor=self.shape_predictor)
|
@@ -284,17 +284,17 @@ with blocks:
|
|
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)
|
300 |
vid_button.click(fn=editor.edit_video, inputs=[input_img, style_choice, edit_choice, vid_format_choice], outputs=vid_output)
|
|
|
179 |
out_img = torch.cat(img_list, axis=0)
|
180 |
utils.save_image(out_img, out_path, nrow=int(np.sqrt(out_img.size(0))), normalize=True, scale_each=True, range=(-1, 1))
|
181 |
|
182 |
+
return str(out_path)
|
183 |
|
184 |
return self.generate_vid(generators, inverted_latent, out_dir, video_format, with_editing)
|
185 |
|
|
|
206 |
else:
|
207 |
shutil.copy2(gen_path, out_path)
|
208 |
|
209 |
+
return str(out_path)
|
210 |
|
211 |
def run_alignment(self, image_path):
|
212 |
aligned_image = align_face(filepath=image_path, predictor=self.shape_predictor)
|
|
|
284 |
with gr.Column():
|
285 |
img_button = gr.Button("Edit Image")
|
286 |
with gr.Column():
|
287 |
+
img_output = gr.outputs.Image(type="file", label="Output Image")
|
288 |
|
289 |
with gr.TabItem("Create Video"):
|
290 |
with gr.Column():
|
291 |
with gr.Row():
|
292 |
+
vid_button = gr.Button("Generate Video")
|
293 |
edit_choice = gr.inputs.Checkbox(default=False, label="With latent space editing?", optional=False)
|
294 |
vid_format_choice = gr.inputs.Radio(choices=["gif", "mp4"], type="value", default='mp4', label="Video Format")
|
|
|
295 |
|
296 |
with gr.Column():
|
297 |
+
vid_output = gr.outputs.Video(label="Output Video")
|
298 |
|
299 |
img_button.click(fn=editor.edit_image, inputs=[input_img, style_choice], outputs=img_output)
|
300 |
vid_button.click(fn=editor.edit_video, inputs=[input_img, style_choice, edit_choice, vid_format_choice], outputs=vid_output)
|