Update gradio_pipeline.py

This commit is contained in:
Mystery099 2024-08-09 12:57:03 +08:00 committed by GitHub
parent 36b3ec1770
commit 14ef3d1ef1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -166,7 +166,7 @@ class GradioPipeline(LivePortraitPipeline):
tab_selection=None, tab_selection=None,
v_tab_selection=None v_tab_selection=None
): ):
""" for video-driven potrait animation or video editing """ for video-driven portrait animation or video editing
""" """
if tab_selection == 'Image': if tab_selection == 'Image':
input_source_path = input_source_image_path input_source_path = input_source_image_path
@ -175,18 +175,22 @@ class GradioPipeline(LivePortraitPipeline):
else: else:
input_source_path = input_source_image_path input_source_path = input_source_image_path
if v_tab_selection == 'Pickle' and input_driving_video_pickle_path is not None: if v_tab_selection == 'Video':
input_driving_video_path = input_driving_video_pickle_path input_driving_path = input_driving_video_path
elif v_tab_selection == 'Pickle':
input_driving_path = input_driving_video_pickle_path
else:
input_driving_path = input_driving_video_path
if input_source_path is not None and input_driving_video_path is not None: if input_source_path is not None and input_driving_path is not None:
if v_tab_selection != 'Pickle' and osp.exists(input_driving_video_path) and is_square_video(input_driving_video_path) is False: if osp.exists(input_driving_path) and v_tab_selection == 'Video' and is_square_video(input_driving_path) is False:
flag_crop_driving_video_input = True flag_crop_driving_video_input = True
log("The driving video is not square, it will be cropped to square automatically.") log("The driving video is not square, it will be cropped to square automatically.")
gr.Info("The driving video is not square, it will be cropped to square automatically.", duration=2) gr.Info("The driving video is not square, it will be cropped to square automatically.", duration=2)
args_user = { args_user = {
'source': input_source_path, 'source': input_source_path,
'driving': input_driving_video_path, 'driving': input_driving_path,
'flag_relative_motion': flag_relative_input, 'flag_relative_motion': flag_relative_input,
'flag_do_crop': flag_do_crop_input, 'flag_do_crop': flag_do_crop_input,
'flag_pasteback': flag_remap_input, 'flag_pasteback': flag_remap_input,