File size: 863 Bytes
87ec96b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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,aaa",
    [
        (TEST_IMAGE_PATH, TEST_EXPRESSION_AAA),
    ]
)
def test_expression_editing(
    input_image: str,
    aaa: int
):
    if not os.path.exists(TEST_IMAGE_PATH):
        download_image(
            TEST_IMAGE_URL,
            TEST_IMAGE_PATH
        )

    inferencer = LivePortraitInferencer()

    edited_expression = inferencer.edit_expression(
        src_image=input_image,
        aaa=aaa
    )
    save_image(numpy_array=edited_expression, output_path=TEST_EXPRESSION_OUTPUT_PATH)

    assert os.path.exists(TEST_EXPRESSION_OUTPUT_PATH)
    assert are_images_different(input_image, TEST_EXPRESSION_OUTPUT_PATH)