jhj0517
commited on
Commit
·
63f92e8
1
Parent(s):
066d06c
Add test for restoration
Browse files
tests/test_image_restoration.py
ADDED
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import pytest
|
3 |
+
|
4 |
+
from test_config import *
|
5 |
+
from modules.live_portrait.live_portrait_inferencer import LivePortraitInferencer
|
6 |
+
|
7 |
+
|
8 |
+
@pytest.mark.parametrize(
|
9 |
+
"input_image",
|
10 |
+
[
|
11 |
+
TEST_IMAGE_PATH
|
12 |
+
]
|
13 |
+
)
|
14 |
+
def test_image_restoration(
|
15 |
+
input_image: str,
|
16 |
+
):
|
17 |
+
if not os.path.exists(TEST_IMAGE_PATH):
|
18 |
+
download_image(
|
19 |
+
TEST_IMAGE_URL,
|
20 |
+
TEST_IMAGE_PATH
|
21 |
+
)
|
22 |
+
|
23 |
+
inferencer = LivePortraitInferencer()
|
24 |
+
|
25 |
+
restored_output = inferencer.resrgan_inferencer.restore_image(
|
26 |
+
input_image
|
27 |
+
)
|
28 |
+
|
29 |
+
assert os.path.exists(restored_output)
|
30 |
+
assert are_images_different(input_image, restored_output)
|