diff --git a/imaginairy/img_processors/control_modes.py b/imaginairy/img_processors/control_modes.py index f9b4ef4e..995697be 100644 --- a/imaginairy/img_processors/control_modes.py +++ b/imaginairy/img_processors/control_modes.py @@ -15,7 +15,7 @@ def create_canny_edges(img: "Tensor") -> "Tensor": img = torch.clamp((img + 1.0) / 2.0, min=0.0, max=1.0) img = einops.rearrange(img[0], "c h w -> h w c") img = (255.0 * img).cpu().numpy().astype(np.uint8).squeeze() - blurred = cv2.GaussianBlur(img, (5, 5), 0).astype(np.uint8) + blurred = cv2.GaussianBlur(img, (5, 5), 0).astype(np.uint8) # type: ignore if len(blurred.shape) > 2: blurred = cv2.cvtColor(blurred, cv2.COLOR_BGR2GRAY) @@ -143,7 +143,7 @@ def make_noise_disk(H: int, W: int, C: int, F: int) -> "np.ndarray": import numpy as np noise = np.random.uniform(low=0, high=1, size=((H // F) + 2, (W // F) + 2, C)) - noise = cv2.resize(noise, (W + 2 * F, H + 2 * F), interpolation=cv2.INTER_CUBIC) + noise = cv2.resize(noise, (W + 2 * F, H + 2 * F), interpolation=cv2.INTER_CUBIC) # type: ignore noise = noise[F : F + H, F : F + W] noise -= np.min(noise) noise /= np.max(noise) @@ -165,7 +165,7 @@ def shuffle_map_np(img: "np.ndarray", h=None, w=None, f=256) -> "np.ndarray": x = make_noise_disk(h, w, 1, f) * float(W - 1) y = make_noise_disk(h, w, 1, f) * float(H - 1) flow = np.concatenate([x, y], axis=2).astype(np.float32) - return cv2.remap(img, flow, None, cv2.INTER_LINEAR) + return cv2.remap(img, flow, None, cv2.INTER_LINEAR) # type: ignore def shuffle_map_torch(tensor: "Tensor", h=None, w=None, f=256) -> "Tensor": diff --git a/tests/img_processors/test_control_modes.py b/tests/img_processors/test_control_modes.py index 16602a69..d862a744 100644 --- a/tests/img_processors/test_control_modes.py +++ b/tests/img_processors/test_control_modes.py @@ -1,11 +1,11 @@ import itertools import pytest -from lightning_fabric import seed_everything from imaginairy.img_processors.control_modes import CONTROL_MODES, create_depth_map from imaginairy.modules.midas.api import ISL_PATHS from imaginairy.schema import LazyLoadingImage +from imaginairy.utils import seed_everything from imaginairy.utils.img_utils import ( pillow_img_to_torch_image, torch_img_to_pillow_img, diff --git a/tests/test_enhancers/test_describe_image_blip.py b/tests/test_enhancers/test_describe_image_blip.py index 89b55eaf..7c7da052 100644 --- a/tests/test_enhancers/test_describe_image_blip.py +++ b/tests/test_enhancers/test_describe_image_blip.py @@ -1,9 +1,8 @@ import pytest -from lightning_fabric import seed_everything from PIL import Image from imaginairy.enhancers.describe_image_blip import generate_caption -from imaginairy.utils import get_device +from imaginairy.utils import get_device, seed_everything from tests import TESTS_FOLDER diff --git a/tests/test_enhancers/test_face_restoration_codeformer.py b/tests/test_enhancers/test_face_restoration_codeformer.py index a500d488..29f9a08f 100644 --- a/tests/test_enhancers/test_face_restoration_codeformer.py +++ b/tests/test_enhancers/test_face_restoration_codeformer.py @@ -1,9 +1,8 @@ import pytest -from lightning_fabric import seed_everything from PIL import Image from imaginairy.enhancers.face_restoration_codeformer import enhance_faces -from imaginairy.utils import get_device +from imaginairy.utils import get_device, seed_everything from tests import TESTS_FOLDER from tests.utils import assert_image_similar_to_expectation