Spaces:
Runtime error
Runtime error
Fixed predict args, minor UI change
Browse files
app.py
CHANGED
@@ -167,6 +167,7 @@ class ImageEditor(object):
|
|
167 |
"tar_text": tar_text_styleclip,
|
168 |
"alpha": alpha_styleclip,
|
169 |
"beta": beta_styleclip}
|
|
|
170 |
|
171 |
return func(self, *args, edit_choices)
|
172 |
|
@@ -195,18 +196,17 @@ class ImageEditor(object):
|
|
195 |
|
196 |
@_pack_edits
|
197 |
def edit_image(self, input, output_styles, edit_choices):
|
198 |
-
return self.predict(input, output_styles, edit_choices)
|
199 |
|
200 |
@_pack_edits
|
201 |
def edit_video(self, input, output_styles, loop_styles, edit_choices):
|
202 |
-
return self.predict(input, output_styles, True, loop_styles, edit_choices)
|
203 |
|
204 |
def predict(
|
205 |
self,
|
206 |
input, # Input image path
|
207 |
output_styles, # Style checkbox options.
|
208 |
generate_video = False, # Generate a video instead of an output image
|
209 |
-
with_editing = False, # Apply latent space editing to the generated video
|
210 |
loop_styles = False, # Loop back to the initial style
|
211 |
edit_choices = None, # Optional dictionary with edit choice arguments
|
212 |
):
|
@@ -330,16 +330,18 @@ with blocks:
|
|
330 |
|
331 |
with gr.Tabs():
|
332 |
with gr.TabItem("Edit Images"):
|
333 |
-
with gr.
|
334 |
-
|
335 |
-
|
336 |
-
|
|
|
337 |
|
338 |
with gr.TabItem("Create Video"):
|
339 |
with gr.Row():
|
340 |
with gr.Column():
|
341 |
-
|
342 |
-
|
|
|
343 |
|
344 |
with gr.Column():
|
345 |
vid_output = gr.outputs.Video(label="Output Video")
|
|
|
167 |
"tar_text": tar_text_styleclip,
|
168 |
"alpha": alpha_styleclip,
|
169 |
"beta": beta_styleclip}
|
170 |
+
|
171 |
|
172 |
return func(self, *args, edit_choices)
|
173 |
|
|
|
196 |
|
197 |
@_pack_edits
|
198 |
def edit_image(self, input, output_styles, edit_choices):
|
199 |
+
return self.predict(input, output_styles, edit_choices=edit_choices)
|
200 |
|
201 |
@_pack_edits
|
202 |
def edit_video(self, input, output_styles, loop_styles, edit_choices):
|
203 |
+
return self.predict(input, output_styles, generate_video=True, loop_styles=loop_styles, edit_choices=edit_choices)
|
204 |
|
205 |
def predict(
|
206 |
self,
|
207 |
input, # Input image path
|
208 |
output_styles, # Style checkbox options.
|
209 |
generate_video = False, # Generate a video instead of an output image
|
|
|
210 |
loop_styles = False, # Loop back to the initial style
|
211 |
edit_choices = None, # Optional dictionary with edit choice arguments
|
212 |
):
|
|
|
330 |
|
331 |
with gr.Tabs():
|
332 |
with gr.TabItem("Edit Images"):
|
333 |
+
with gr.Row():
|
334 |
+
with gr.Column():
|
335 |
+
img_button = gr.Button("Edit Image")
|
336 |
+
with gr.Column():
|
337 |
+
img_output = gr.Gallery(label="Output Images")
|
338 |
|
339 |
with gr.TabItem("Create Video"):
|
340 |
with gr.Row():
|
341 |
with gr.Column():
|
342 |
+
with gr.Row():
|
343 |
+
vid_button = gr.Button("Generate Video")
|
344 |
+
loop_styles = gr.inputs.Checkbox(default=True, label="Loop video back to the initial style?")
|
345 |
|
346 |
with gr.Column():
|
347 |
vid_output = gr.outputs.Video(label="Output Video")
|