From 2e07105c69c060a33efde5dd655a8ff08c6512cb Mon Sep 17 00:00:00 2001 From: Bingsu Date: Fri, 19 May 2023 09:28:10 +0900 Subject: [PATCH] fix: import annotations, misc --- adetailer/args.py | 2 +- adetailer/mask.py | 2 ++ adetailer/mediapipe.py | 4 ++-- adetailer/ultralytics.py | 3 +-- sd_webui/script_callbacks.py | 2 ++ sd_webui/scripts.py | 2 ++ 6 files changed, 10 insertions(+), 5 deletions(-) diff --git a/adetailer/args.py b/adetailer/args.py index 759dd0f..394731e 100644 --- a/adetailer/args.py +++ b/adetailer/args.py @@ -52,8 +52,8 @@ class ADetailerArgs(BaseModel, extra=Extra.forbid): ad_use_steps: bool = False ad_steps: PositiveInt = 28 ad_use_cfg_scale: bool = False - ad_restore_face: bool = False ad_cfg_scale: NonNegativeFloat = 7.0 + ad_restore_face: bool = False ad_controlnet_model: str = "None" ad_controlnet_weight: confloat(ge=0.0, le=1.0) = 1.0 diff --git a/adetailer/mask.py b/adetailer/mask.py index c4bb319..48f9273 100644 --- a/adetailer/mask.py +++ b/adetailer/mask.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from enum import IntEnum from functools import partial, reduce from math import dist diff --git a/adetailer/mediapipe.py b/adetailer/mediapipe.py index 7a3e775..066eabc 100644 --- a/adetailer/mediapipe.py +++ b/adetailer/mediapipe.py @@ -1,4 +1,4 @@ -from typing import Union +from __future__ import annotations import numpy as np from PIL import Image @@ -8,7 +8,7 @@ from adetailer.common import create_mask_from_bbox def mediapipe_predict( - model_type: Union[int, str], image: Image.Image, confidence: float = 0.3 + model_type: int | str, image: Image.Image, confidence: float = 0.3 ) -> PredictOutput: import mediapipe as mp diff --git a/adetailer/ultralytics.py b/adetailer/ultralytics.py index fff133b..b44703e 100644 --- a/adetailer/ultralytics.py +++ b/adetailer/ultralytics.py @@ -1,7 +1,6 @@ from __future__ import annotations from pathlib import Path -from typing import Union import cv2 from PIL import Image @@ -11,7 +10,7 @@ from adetailer.common import create_mask_from_bbox def ultralytics_predict( - model_path: Union[str, Path], + model_path: str | Path, image: Image.Image, confidence: float = 0.3, device: str = "", diff --git a/sd_webui/script_callbacks.py b/sd_webui/script_callbacks.py index b1c9136..5183e47 100644 --- a/sd_webui/script_callbacks.py +++ b/sd_webui/script_callbacks.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from typing import TYPE_CHECKING if TYPE_CHECKING: diff --git a/sd_webui/scripts.py b/sd_webui/scripts.py index 2872a7f..a161a8b 100644 --- a/sd_webui/scripts.py +++ b/sd_webui/scripts.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from typing import TYPE_CHECKING if TYPE_CHECKING: