fix paint_by_example test

This commit is contained in:
Qing 2024-04-30 13:13:13 +08:00
parent acd5726ecb
commit 30b29db668

View File

@ -1,6 +1,7 @@
import cv2 import cv2
import pytest import pytest
from PIL import Image from PIL import Image
from iopaint.helper import encode_pil_to_base64
from iopaint.model_manager import ModelManager from iopaint.model_manager import ModelManager
from iopaint.schema import HDStrategy from iopaint.schema import HDStrategy
@ -34,7 +35,9 @@ def assert_equal(
) )
print(f"Input image shape: {img.shape}, example_image: {example_image.shape}") print(f"Input image shape: {img.shape}, example_image: {example_image.shape}")
config.paint_by_example_example_image = Image.fromarray(example_image) config.paint_by_example_example_image = encode_pil_to_base64(
Image.fromarray(example_image), 100, {}
).decode("utf-8")
res = model(img, mask, config) res = model(img, mask, config)
cv2.imwrite(str(save_dir / save_name), res) cv2.imwrite(str(save_dir / save_name), res)