fix: version requirements

This commit is contained in:
Dowon
2024-05-27 23:43:38 +09:00
parent 479f5f4a2e
commit 72647e5bfa
5 changed files with 18 additions and 30 deletions

View File

@@ -1,19 +1,14 @@
from __future__ import annotations
from PIL import Image
from rich import print
try:
from modules.processing import create_binary_mask
except ImportError:
msg = "[-] ADetailer: Support for webui versions below 1.6.0 will be discontinued."
print(msg)
def create_binary_mask(image: Image.Image):
return image.convert("L")
from modules.processing import create_binary_mask # noqa: F401
except ImportError as e:
msg = "[-] ADetailer: WebUI versions below 1.6.0 are not supported."
raise RuntimeError(msg) from e
try:
from modules.sd_schedulers import schedulers
except ImportError:
# webui < 1.9.0
schedulers = []

View File

@@ -3,13 +3,15 @@ from __future__ import annotations
import io
import platform
import sys
from collections.abc import Callable
from importlib.metadata import version
from typing import Any, Callable
from typing import Any, TypeVar
from rich.console import Console, Group
from rich.panel import Panel
from rich.table import Table
from rich.traceback import Traceback
from typing_extensions import ParamSpec
from adetailer.__version__ import __version__
from adetailer.args import ADetailerArgs
@@ -137,7 +139,11 @@ def get_table(title: str, data: dict[str, Any]) -> Table:
return table
def rich_traceback(func: Callable) -> Callable:
P = ParamSpec("P")
T = TypeVar("T")
def rich_traceback(func: Callable[P, T]) -> Callable[P, T]:
def wrapper(*args, **kwargs):
string = io.StringIO()
width = Console().width

View File

@@ -4,22 +4,12 @@ import importlib
import sys
from functools import lru_cache
from pathlib import Path
from textwrap import dedent
from modules import extensions, sd_models, shared
from modules.paths import extensions_builtin_dir, extensions_dir, models_path
from .common import cn_model_module, cn_model_regex
try:
from modules.paths import extensions_builtin_dir, extensions_dir, models_path
except ImportError as e:
msg = """
[-] ADetailer: `stable-diffusion-webui < 1.1.0` is no longer supported.
Please upgrade to stable-diffusion-webui >= 1.1.0.
or you can use ADetailer v23.10.1 (https://github.com/Bing-su/adetailer/archive/refs/tags/v23.10.1.zip)
"""
raise RuntimeError(dedent(msg)) from e
ext_path = Path(extensions_dir)
ext_builtin_path = Path(extensions_builtin_dir)
controlnet_exists = False

View File

@@ -2,12 +2,12 @@
name = "adetailer"
description = "An object detection and auto-mask extension for stable diffusion webui."
authors = [{ name = "dowon", email = "ks2515@naver.com" }]
requires-python = ">=3.8"
requires-python = ">=3.9"
readme = "README.md"
license = { text = "AGPL-3.0" }
dependencies = [
"ultralytics>=8.2",
"mediapipe>=0.10",
"mediapipe>=0.10.13",
"pydantic<3",
"rich>=13",
"huggingface_hub",
@@ -39,7 +39,7 @@ profile = "black"
known_first_party = ["launch", "modules"]
[tool.ruff]
target-version = "py38"
target-version = "py39"
[tool.ruff.lint]
select = [

View File

@@ -121,10 +121,7 @@ class AfterDetailerScript(scripts.Script):
sampler_names = [sampler.name for sampler in all_samplers]
scheduler_names = [x.label for x in schedulers]
try:
checkpoint_list = modules.sd_models.checkpoint_tiles(use_shorts=True)
except TypeError:
checkpoint_list = modules.sd_models.checkpoint_tiles()
checkpoint_list = modules.sd_models.checkpoint_tiles(use_shorts=True)
vae_list = modules.shared_items.sd_vae_items()
webui_info = WebuiInfo(