From cd070d8be9daf3992ce6c080015749fa35a3488a Mon Sep 17 00:00:00 2001 From: dunkeroni Date: Sun, 18 Feb 2024 23:11:36 -0500 Subject: [PATCH] chore: ruff formatting --- invokeai/app/invocations/constants.py | 2 +- invokeai/app/invocations/controlnet_image_processors.py | 2 +- invokeai/app/invocations/image.py | 2 +- invokeai/app/services/shared/invocation_context.py | 6 ++++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/invokeai/app/invocations/constants.py b/invokeai/app/invocations/constants.py index fca5a2ec7f..cebe0eb30f 100644 --- a/invokeai/app/invocations/constants.py +++ b/invokeai/app/invocations/constants.py @@ -14,4 +14,4 @@ SCHEDULER_NAME_VALUES = Literal[tuple(SCHEDULER_MAP.keys())] """A literal type representing the valid scheduler names.""" IMAGE_MODES = Literal["L", "RGB", "RGBA", "CMYK", "YCbCr", "LAB", "HSV", "I", "F"] -"""A literal type for PIL image modes supported by Invoke""" \ No newline at end of file +"""A literal type for PIL image modes supported by Invoke""" diff --git a/invokeai/app/invocations/controlnet_image_processors.py b/invokeai/app/invocations/controlnet_image_processors.py index 1e998e4b61..8774f2fb27 100644 --- a/invokeai/app/invocations/controlnet_image_processors.py +++ b/invokeai/app/invocations/controlnet_image_processors.py @@ -591,7 +591,7 @@ class DepthAnythingImageProcessorInvocation(ImageProcessorInvocation): def run_processor(self, image: Image.Image): depth_anything_detector = DepthAnythingDetector() depth_anything_detector.load_model(model_size=self.model_size) - + processed_image = depth_anything_detector(image=image, resolution=self.resolution, offload=self.offload) return processed_image diff --git a/invokeai/app/invocations/image.py b/invokeai/app/invocations/image.py index 1f3b5b7368..a0c41161c3 100644 --- a/invokeai/app/invocations/image.py +++ b/invokeai/app/invocations/image.py @@ -7,6 +7,7 @@ import cv2 import numpy from PIL import Image, ImageChops, ImageFilter, ImageOps +from invokeai.app.invocations.constants import IMAGE_MODES from invokeai.app.invocations.fields import ( ColorField, FieldDescriptions, @@ -16,7 +17,6 @@ from invokeai.app.invocations.fields import ( WithMetadata, ) from invokeai.app.invocations.primitives import ImageOutput -from invokeai.app.invocations.constants import IMAGE_MODES from invokeai.app.services.image_records.image_records_common import ImageCategory from invokeai.app.services.shared.invocation_context import InvocationContext from invokeai.backend.image_util.invisible_watermark import InvisibleWatermark diff --git a/invokeai/app/services/shared/invocation_context.py b/invokeai/app/services/shared/invocation_context.py index 2383785ad4..43ecb2c543 100644 --- a/invokeai/app/services/shared/invocation_context.py +++ b/invokeai/app/services/shared/invocation_context.py @@ -5,8 +5,8 @@ from typing import TYPE_CHECKING, Optional from PIL.Image import Image from torch import Tensor -from invokeai.app.invocations.fields import MetadataField, WithBoard, WithMetadata from invokeai.app.invocations.constants import IMAGE_MODES +from invokeai.app.invocations.fields import MetadataField, WithBoard, WithMetadata from invokeai.app.services.boards.boards_common import BoardDTO from invokeai.app.services.config.config_default import InvokeAIAppConfig from invokeai.app.services.image_records.image_records_common import ImageCategory, ResourceOrigin @@ -207,7 +207,9 @@ class ImagesInterface(InvocationContextInterface): try: image = image.convert(mode) except ValueError: - self._services.logger.warning(f"Could not convert image from {image.mode} to {mode}. Using original mode instead.") + self._services.logger.warning( + f"Could not convert image from {image.mode} to {mode}. Using original mode instead." + ) return image def get_metadata(self, image_name: str) -> Optional[MetadataField]: