Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -70,8 +70,6 @@ data_examples = [
|
|
70 |
#################### interface logic ####################
|
71 |
|
72 |
# Define components first
|
73 |
-
eye_retargeting_slider = gr.Slider(minimum=0, maximum=0.8, step=0.01, label="target eyes-open ratio")
|
74 |
-
lip_retargeting_slider = gr.Slider(minimum=0, maximum=0.8, step=0.01, label="target lip-open ratio")
|
75 |
retargeting_input_image = gr.Image(type="filepath")
|
76 |
output_image = gr.Image(type="numpy")
|
77 |
output_image_paste_back = gr.Image(type="numpy")
|
@@ -79,8 +77,7 @@ output_video = gr.Video()
|
|
79 |
output_video_concat = gr.Video()
|
80 |
|
81 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
82 |
-
gr.
|
83 |
-
gr.Markdown(load_description("assets/gradio_description_upload.md"))
|
84 |
with gr.Row():
|
85 |
with gr.Accordion(open=True, label="Source Portrait"):
|
86 |
image_input = gr.Image(type="filepath")
|
@@ -111,12 +108,10 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
111 |
)
|
112 |
with gr.Row():
|
113 |
with gr.Accordion(open=False, label="Animation Instructions and Options"):
|
114 |
-
gr.Markdown(load_description("assets/gradio_description_animation.md"))
|
115 |
with gr.Row():
|
116 |
flag_relative_input = gr.Checkbox(value=True, label="relative motion")
|
117 |
flag_do_crop_input = gr.Checkbox(value=True, label="do crop")
|
118 |
flag_remap_input = gr.Checkbox(value=True, label="paste-back")
|
119 |
-
gr.Markdown(load_description("assets/gradio_description_animate_clear.md"))
|
120 |
with gr.Row():
|
121 |
with gr.Column():
|
122 |
process_button_animation = gr.Button("🚀 Animate", variant="primary")
|
@@ -163,36 +158,6 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
163 |
],
|
164 |
value="🧹 Clear"
|
165 |
)
|
166 |
-
with gr.Row(visible=True):
|
167 |
-
with gr.Column():
|
168 |
-
with gr.Accordion(open=True, label="Retargeting Input"):
|
169 |
-
retargeting_input_image.render()
|
170 |
-
gr.Examples(
|
171 |
-
examples=[
|
172 |
-
[osp.join(example_portrait_dir, "s9.jpg")],
|
173 |
-
[osp.join(example_portrait_dir, "s6.jpg")],
|
174 |
-
[osp.join(example_portrait_dir, "s10.jpg")],
|
175 |
-
[osp.join(example_portrait_dir, "s5.jpg")],
|
176 |
-
[osp.join(example_portrait_dir, "s7.jpg")],
|
177 |
-
[osp.join(example_portrait_dir, "s12.jpg")],
|
178 |
-
],
|
179 |
-
inputs=[retargeting_input_image],
|
180 |
-
cache_examples=False,
|
181 |
-
)
|
182 |
-
with gr.Column():
|
183 |
-
with gr.Accordion(open=True, label="Retargeting Result"):
|
184 |
-
output_image.render()
|
185 |
-
with gr.Column():
|
186 |
-
with gr.Accordion(open=True, label="Paste-back Result"):
|
187 |
-
output_image_paste_back.render()
|
188 |
-
# binding functions for buttons
|
189 |
-
process_button_retargeting.click(
|
190 |
-
# fn=gradio_pipeline.execute_image,
|
191 |
-
fn=gpu_wrapped_execute_image,
|
192 |
-
inputs=[eye_retargeting_slider, lip_retargeting_slider, retargeting_input_image, flag_do_crop_input],
|
193 |
-
outputs=[output_image, output_image_paste_back],
|
194 |
-
show_progress=True
|
195 |
-
)
|
196 |
process_button_animation.click(
|
197 |
fn=gpu_wrapped_execute_video,
|
198 |
inputs=[
|
|
|
70 |
#################### interface logic ####################
|
71 |
|
72 |
# Define components first
|
|
|
|
|
73 |
retargeting_input_image = gr.Image(type="filepath")
|
74 |
output_image = gr.Image(type="numpy")
|
75 |
output_image_paste_back = gr.Image(type="numpy")
|
|
|
77 |
output_video_concat = gr.Video()
|
78 |
|
79 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
80 |
+
gr.Markdown("Talking Head")
|
|
|
81 |
with gr.Row():
|
82 |
with gr.Accordion(open=True, label="Source Portrait"):
|
83 |
image_input = gr.Image(type="filepath")
|
|
|
108 |
)
|
109 |
with gr.Row():
|
110 |
with gr.Accordion(open=False, label="Animation Instructions and Options"):
|
|
|
111 |
with gr.Row():
|
112 |
flag_relative_input = gr.Checkbox(value=True, label="relative motion")
|
113 |
flag_do_crop_input = gr.Checkbox(value=True, label="do crop")
|
114 |
flag_remap_input = gr.Checkbox(value=True, label="paste-back")
|
|
|
115 |
with gr.Row():
|
116 |
with gr.Column():
|
117 |
process_button_animation = gr.Button("🚀 Animate", variant="primary")
|
|
|
158 |
],
|
159 |
value="🧹 Clear"
|
160 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
process_button_animation.click(
|
162 |
fn=gpu_wrapped_execute_video,
|
163 |
inputs=[
|