mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-05-02 04:01:42 +00:00
fix: no __future__ import
This commit is contained in:
@@ -1 +1 @@
|
|||||||
__version__ = "23.5.3"
|
__version__ = "23.5.3.post0"
|
||||||
|
|||||||
@@ -1,9 +1,7 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional, Union
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -20,7 +18,7 @@ class PredictOutput:
|
|||||||
preview: Optional[Image.Image] = None
|
preview: Optional[Image.Image] = None
|
||||||
|
|
||||||
|
|
||||||
def get_models(model_dir: str | Path) -> OrderedDict[str, str | None]:
|
def get_models(model_dir: Union[str, Path]) -> OrderedDict[str, Optional[str]]:
|
||||||
model_dir = Path(model_dir)
|
model_dir = Path(model_dir)
|
||||||
if model_dir.is_dir():
|
if model_dir.is_dir():
|
||||||
model_paths = [
|
model_paths = [
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from __future__ import annotations
|
from typing import Union
|
||||||
|
|
||||||
import mediapipe as mp
|
import mediapipe as mp
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -9,7 +9,7 @@ from adetailer.common import create_mask_from_bbox
|
|||||||
|
|
||||||
|
|
||||||
def mediapipe_predict(
|
def mediapipe_predict(
|
||||||
model_type: int | str, image: Image.Image, confidence: float = 0.3
|
model_type: Union[int, str], image: Image.Image, confidence: float = 0.3
|
||||||
) -> PredictOutput:
|
) -> PredictOutput:
|
||||||
if isinstance(model_type, str):
|
if isinstance(model_type, str):
|
||||||
model_type = mediapipe_model_name_to_type(model_type)
|
model_type = mediapipe_model_name_to_type(model_type)
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Union
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
@@ -11,7 +10,7 @@ from adetailer.common import create_mask_from_bbox
|
|||||||
|
|
||||||
|
|
||||||
def ultralytics_predict(
|
def ultralytics_predict(
|
||||||
model_path: str | Path,
|
model_path: Union[str, Path],
|
||||||
image: Image.Image,
|
image: Image.Image,
|
||||||
confidence: float = 0.3,
|
confidence: float = 0.3,
|
||||||
device: str = "",
|
device: str = "",
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import importlib
|
import importlib
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import importlib.util
|
import importlib.util
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
from importlib.metadata import version # python >= 3.8
|
from importlib.metadata import version # python >= 3.8
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from packaging.version import parse
|
from packaging.version import parse
|
||||||
|
|
||||||
|
|
||||||
def is_installed(
|
def is_installed(
|
||||||
package: str, min_version: str | None = None, max_version: str | None = None
|
package: str, min_version: Optional[str] = None, max_version: Optional[str] = None
|
||||||
):
|
):
|
||||||
try:
|
try:
|
||||||
spec = importlib.util.find_spec(package)
|
spec = importlib.util.find_spec(package)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ description = "An object detection and auto-mask extension for stable diffusion
|
|||||||
authors = [
|
authors = [
|
||||||
{name = "dowon", email = "ks2515@naver.com"},
|
{name = "dowon", email = "ks2515@naver.com"},
|
||||||
]
|
]
|
||||||
requires-python = ">=3.8,<3.12"
|
requires-python = ">=3.9,<3.12"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
license = {text = "AGPL-3.0"}
|
license = {text = "AGPL-3.0"}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
from __future__ import annotations
|
|
||||||
|
|
||||||
import platform
|
import platform
|
||||||
import sys
|
import sys
|
||||||
from copy import copy
|
from copy import copy
|
||||||
|
|||||||
Reference in New Issue
Block a user