Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -35,6 +35,14 @@ gradio_pipeline = GradioPipeline(
|
|
| 35 |
args=args
|
| 36 |
)
|
| 37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 38 |
# assets
|
| 39 |
title_md = "assets/gradio_title.md"
|
| 40 |
example_portrait_dir = "assets/examples/source"
|
|
@@ -111,7 +119,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 111 |
with gr.Row():
|
| 112 |
gr.Examples(
|
| 113 |
examples=data_examples,
|
| 114 |
-
fn=
|
| 115 |
inputs=[
|
| 116 |
image_input,
|
| 117 |
video_input,
|
|
@@ -121,7 +129,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 121 |
],
|
| 122 |
outputs=[output_image, output_image_paste_back],
|
| 123 |
examples_per_page=5,
|
| 124 |
-
cache_examples=
|
| 125 |
)
|
| 126 |
gr.Markdown(load_description("assets/gradio_description_retargeting.md"))
|
| 127 |
with gr.Row():
|
|
@@ -152,13 +160,13 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 152 |
# binding functions for buttons
|
| 153 |
process_button_retargeting.click(
|
| 154 |
# fn=gradio_pipeline.execute_image,
|
| 155 |
-
fn=
|
| 156 |
inputs=[eye_retargeting_slider, lip_retargeting_slider],
|
| 157 |
outputs=[output_image, output_image_paste_back],
|
| 158 |
show_progress=True
|
| 159 |
)
|
| 160 |
process_button_animation.click(
|
| 161 |
-
fn=
|
| 162 |
inputs=[
|
| 163 |
image_input,
|
| 164 |
video_input,
|
|
|
|
| 35 |
args=args
|
| 36 |
)
|
| 37 |
|
| 38 |
+
@spaces.GPU(duration=240)
|
| 39 |
+
def gpu_wrapped_execute_video(*args, **kwargs):
|
| 40 |
+
return gradio_pipeline.execute_video(*args, **kwargs)
|
| 41 |
+
|
| 42 |
+
@spaces.GPU(duration=240)
|
| 43 |
+
def gpu_wrapped_execute_image(*args, **kwargs):
|
| 44 |
+
return gradio_pipeline.execute_image(*args, **kwargs)
|
| 45 |
+
|
| 46 |
# assets
|
| 47 |
title_md = "assets/gradio_title.md"
|
| 48 |
example_portrait_dir = "assets/examples/source"
|
|
|
|
| 119 |
with gr.Row():
|
| 120 |
gr.Examples(
|
| 121 |
examples=data_examples,
|
| 122 |
+
fn=gpu_wrapped_execute_video,
|
| 123 |
inputs=[
|
| 124 |
image_input,
|
| 125 |
video_input,
|
|
|
|
| 129 |
],
|
| 130 |
outputs=[output_image, output_image_paste_back],
|
| 131 |
examples_per_page=5,
|
| 132 |
+
cache_examples=False,
|
| 133 |
)
|
| 134 |
gr.Markdown(load_description("assets/gradio_description_retargeting.md"))
|
| 135 |
with gr.Row():
|
|
|
|
| 160 |
# binding functions for buttons
|
| 161 |
process_button_retargeting.click(
|
| 162 |
# fn=gradio_pipeline.execute_image,
|
| 163 |
+
fn=gpu_wrapped_execute_image,
|
| 164 |
inputs=[eye_retargeting_slider, lip_retargeting_slider],
|
| 165 |
outputs=[output_image, output_image_paste_back],
|
| 166 |
show_progress=True
|
| 167 |
)
|
| 168 |
process_button_animation.click(
|
| 169 |
+
fn=gpu_wrapped_execute_video,
|
| 170 |
inputs=[
|
| 171 |
image_input,
|
| 172 |
video_input,
|