File size: 953 Bytes
e6eff1c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
050ea7e
e6eff1c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
import pytest

from test_config import *
from modules.live_portrait.live_portrait_inferencer import LivePortraitInferencer
from modules.utils.image_helper import save_image


@pytest.mark.parametrize(
    "input_image,expression_video",
    [
        (TEST_IMAGE_PATH, TEST_VIDEO_PATH),
    ]
)
def test_video_creation(
    input_image: str,
    expression_video: str
):
    if not os.path.exists(TEST_IMAGE_PATH):
        download_image(
            TEST_IMAGE_URL,
            TEST_IMAGE_PATH
        )
    if not os.path.exists(TEST_VIDEO_PATH):
        download_image(
            TEST_VIDEO_URL,
            TEST_VIDEO_PATH
        )

    inferencer = LivePortraitInferencer()

    output_video_path = inferencer.create_video(
        driving_vid_path=expression_video,
        src_image=input_image,
    )

    assert os.path.exists(output_video_path)
    assert validate_video(output_video_path)
    assert has_sound(output_video_path)