mirror of
https://github.com/Bing-su/adetailer.git
synced 2026-01-26 19:29:54 +00:00
fix(modules): conditional imports
This commit is contained in:
16
aaaaaa/conditional.py
Normal file
16
aaaaaa/conditional.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from PIL import Image
|
||||
|
||||
try:
|
||||
from modules.processing import create_binary_mask
|
||||
except ImportError:
|
||||
|
||||
def create_binary_mask(image: Image.Image):
|
||||
return image.convert("L")
|
||||
|
||||
|
||||
try:
|
||||
from modules.sd_schedulers import schedulers
|
||||
except ImportError:
|
||||
schedulers = []
|
||||
@@ -16,6 +16,7 @@ from PIL import Image, ImageChops
|
||||
from rich import print
|
||||
|
||||
import modules
|
||||
from aaaaaa.conditional import create_binary_mask, schedulers
|
||||
from aaaaaa.helper import (
|
||||
change_torch_load,
|
||||
copy_extra_params,
|
||||
@@ -67,23 +68,6 @@ from modules.processing import (
|
||||
from modules.sd_samplers import all_samplers
|
||||
from modules.shared import cmd_opts, opts, state
|
||||
|
||||
try:
|
||||
from modules.processing import create_binary_mask
|
||||
except ImportError:
|
||||
|
||||
def create_binary_mask(image: Image.Image):
|
||||
return image.convert("L")
|
||||
|
||||
|
||||
try:
|
||||
from modules.sd_schedulers import schedulers
|
||||
|
||||
scheduler_available = True
|
||||
except ImportError:
|
||||
schedulers = []
|
||||
scheduler_available = False
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from fastapi import FastAPI
|
||||
|
||||
@@ -493,7 +477,7 @@ class AfterDetailerScript(scripts.Script):
|
||||
override_settings = self.get_override_settings(p, args)
|
||||
|
||||
version_args = {}
|
||||
if scheduler_available:
|
||||
if schedulers:
|
||||
version_args.update(self.get_scheduler(p, args))
|
||||
|
||||
i2i = StableDiffusionProcessingImg2Img(
|
||||
|
||||
Reference in New Issue
Block a user