mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-04-30 19:21:33 +00:00
fix: dataclass to pydantic dataclass
This commit is contained in:
@@ -1,18 +1,22 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
from dataclasses import dataclass
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from huggingface_hub import hf_hub_download
|
from huggingface_hub import hf_hub_download
|
||||||
from PIL import Image, ImageDraw
|
from PIL import Image, ImageDraw
|
||||||
|
from pydantic.dataclasses import dataclass
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class PredictOutput:
|
class PredictOutput:
|
||||||
bboxes: list[list[int]] | None = None
|
bboxes: Optional[list[list[int]]] = None
|
||||||
masks: list[Image.Image] | None = None
|
masks: Optional[list[Image.Image]] = None
|
||||||
preview: Image.Image | None = None
|
preview: Optional[Image.Image] = None
|
||||||
|
|
||||||
|
class Config:
|
||||||
|
arbitrary_types_allowed = True
|
||||||
|
|
||||||
|
|
||||||
def get_models(model_dir: str | Path) -> OrderedDict[str, str | None]:
|
def get_models(model_dir: str | Path) -> OrderedDict[str, str | None]:
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ known_first_party = ["modules", "launch"]
|
|||||||
|
|
||||||
[tool.ruff]
|
[tool.ruff]
|
||||||
select = ["A", "B", "C4", "E", "F", "I001", "ISC", "N", "PIE", "PT", "RET", "SIM", "UP", "W"]
|
select = ["A", "B", "C4", "E", "F", "I001", "ISC", "N", "PIE", "PT", "RET", "SIM", "UP", "W"]
|
||||||
ignore = ["B008", "B905", "E501"]
|
ignore = ["B008", "B905", "E501", "UP007"]
|
||||||
unfixable = ["F401"]
|
unfixable = ["F401"]
|
||||||
|
|
||||||
[tool.ruff.isort]
|
[tool.ruff.isort]
|
||||||
|
|||||||
Reference in New Issue
Block a user