From 5c82076d4f0235625a4ddbd8ff7a87d7fef01f53 Mon Sep 17 00:00:00 2001 From: liaoxiju Date: Fri, 6 Dec 2024 15:33:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 test.py diff --git a/test.py b/test.py new file mode 100644 index 0000000..f33e7c2 --- /dev/null +++ b/test.py @@ -0,0 +1,29 @@ +from modelscope.piplines import pipeline + +# Create a pipeline instance for talking head generation using the specified model and revision. +inference = pipeline('talking-head', model='./wwd123/sadtalker', model_revision='v1.0.0') + +# Define the input source image and audio file paths. +source_image = "liao.jpg" +driven_audio = "xx_cn.wav" + +# Set the output directory where results will be saved. +out_dir = "./results/" + +# Configure various parameters for the inference process: +kwargs = { + 'preprocess': 'full', # Options are 'crop', 'resize', or 'full' + 'still_mode': True, + 'use_enhancer': False, + 'batch_size': 1, + 'size': 256, # Image size can be either 256 or 512 pixels + 'pose_style': 0, + 'exp_scale': 1, + 'result_dir': out_dir +} + +# Perform inference to generate the video from the source image and audio. +video_path = inference(source_image=source_image, driven_audio=driven_audio, **kwargs) + +# Print the path of the generated video file. +print(f"==>> video_path: {video_path}") \ No newline at end of file