cbhhhcb commited on
Commit
7c6320d
1 Parent(s): 48494f7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -64
app.py CHANGED
@@ -149,75 +149,75 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
149
  examples_per_page=6,
150
  cache_examples=False,
151
  )
152
- gr.Markdown(load_description("assets/gradio_description_retargeting.md"), visible=True)
153
- with gr.Row(visible=True):
154
- eye_retargeting_slider.render()
155
- lip_retargeting_slider.render()
156
- with gr.Row(visible=True):
157
- process_button_retargeting = gr.Button("🚗 Retargeting", variant="primary")
158
- process_button_reset_retargeting = gr.ClearButton(
159
- [
160
- eye_retargeting_slider,
161
- lip_retargeting_slider,
162
- retargeting_input_image,
163
- output_image,
164
- output_image_paste_back
165
- ],
166
- value="🧹 Clear"
167
- )
168
- with gr.Row(visible=True):
169
- with gr.Column():
170
- with gr.Accordion(open=True, label="Retargeting Input"):
171
- retargeting_input_image.render()
172
- gr.Examples(
173
- examples=[
174
- [osp.join(example_portrait_dir, "s9.jpg")],
175
- [osp.join(example_portrait_dir, "s6.jpg")],
176
- [osp.join(example_portrait_dir, "s10.jpg")],
177
- [osp.join(example_portrait_dir, "s5.jpg")],
178
- [osp.join(example_portrait_dir, "s7.jpg")],
179
- [osp.join(example_portrait_dir, "s12.jpg")],
180
- [osp.join(example_portrait_dir, "s22.jpg")],
181
- ],
182
- inputs=[retargeting_input_image],
183
- cache_examples=False,
184
- )
185
- with gr.Column():
186
- with gr.Accordion(open=True, label="Retargeting Result"):
187
- output_image.render()
188
- with gr.Column():
189
- with gr.Accordion(open=True, label="Paste-back Result"):
190
- output_image_paste_back.render()
191
- # binding functions for buttons
192
- process_button_retargeting.click(
193
- # fn=gradio_pipeline.execute_image,
194
- fn=gpu_wrapped_execute_image,
195
- inputs=[eye_retargeting_slider, lip_retargeting_slider, retargeting_input_image, flag_do_crop_input],
196
- outputs=[output_image, output_image_paste_back],
197
- show_progress=True
198
- )
199
- process_button_animation.click(
200
- fn=gpu_wrapped_execute_video,
201
- inputs=[
202
- image_input,
203
- video_input,
204
- flag_relative_input,
205
- flag_do_crop_input,
206
- flag_remap_input
207
- ],
208
- outputs=[output_video, output_video_concat],
209
- show_progress=True
210
- )
211
  # image_input.change(
212
  # fn=gradio_pipeline.prepare_retargeting,
213
  # inputs=image_input,
214
  # outputs=[eye_retargeting_slider, lip_retargeting_slider, retargeting_input_image]
215
  # )
216
- video_input.upload(
217
- fn=is_square_video,
218
- inputs=video_input,
219
- outputs=video_input
220
- )
221
 
222
  demo.launch(
223
  server_port=args.server_port,
 
149
  examples_per_page=6,
150
  cache_examples=False,
151
  )
152
+ # gr.Markdown(load_description("assets/gradio_description_retargeting.md"), visible=True)
153
+ # with gr.Row(visible=True):
154
+ # eye_retargeting_slider.render()
155
+ # lip_retargeting_slider.render()
156
+ # with gr.Row(visible=True):
157
+ # process_button_retargeting = gr.Button("🚗 Retargeting", variant="primary")
158
+ # process_button_reset_retargeting = gr.ClearButton(
159
+ # [
160
+ # eye_retargeting_slider,
161
+ # lip_retargeting_slider,
162
+ # retargeting_input_image,
163
+ # output_image,
164
+ # output_image_paste_back
165
+ # ],
166
+ # value="🧹 Clear"
167
+ # )
168
+ # with gr.Row(visible=True):
169
+ # with gr.Column():
170
+ # with gr.Accordion(open=True, label="Retargeting Input"):
171
+ # retargeting_input_image.render()
172
+ # gr.Examples(
173
+ # examples=[
174
+ # [osp.join(example_portrait_dir, "s9.jpg")],
175
+ # [osp.join(example_portrait_dir, "s6.jpg")],
176
+ # [osp.join(example_portrait_dir, "s10.jpg")],
177
+ # [osp.join(example_portrait_dir, "s5.jpg")],
178
+ # [osp.join(example_portrait_dir, "s7.jpg")],
179
+ # [osp.join(example_portrait_dir, "s12.jpg")],
180
+ # [osp.join(example_portrait_dir, "s22.jpg")],
181
+ # ],
182
+ # inputs=[retargeting_input_image],
183
+ # cache_examples=False,
184
+ # )
185
+ # with gr.Column():
186
+ # with gr.Accordion(open=True, label="Retargeting Result"):
187
+ # output_image.render()
188
+ # with gr.Column():
189
+ # with gr.Accordion(open=True, label="Paste-back Result"):
190
+ # output_image_paste_back.render()
191
+ # # binding functions for buttons
192
+ # process_button_retargeting.click(
193
+ # # fn=gradio_pipeline.execute_image,
194
+ # fn=gpu_wrapped_execute_image,
195
+ # inputs=[eye_retargeting_slider, lip_retargeting_slider, retargeting_input_image, flag_do_crop_input],
196
+ # outputs=[output_image, output_image_paste_back],
197
+ # show_progress=True
198
+ # )
199
+ # process_button_animation.click(
200
+ # fn=gpu_wrapped_execute_video,
201
+ # inputs=[
202
+ # image_input,
203
+ # video_input,
204
+ # flag_relative_input,
205
+ # flag_do_crop_input,
206
+ # flag_remap_input
207
+ # ],
208
+ # outputs=[output_video, output_video_concat],
209
+ # show_progress=True
210
+ # )
211
  # image_input.change(
212
  # fn=gradio_pipeline.prepare_retargeting,
213
  # inputs=image_input,
214
  # outputs=[eye_retargeting_slider, lip_retargeting_slider, retargeting_input_image]
215
  # )
216
+ # video_input.upload(
217
+ # fn=is_square_video,
218
+ # inputs=video_input,
219
+ # outputs=video_input
220
+ # )
221
 
222
  demo.launch(
223
  server_port=args.server_port,