2022-04-15 18:11:51 +02:00
|
|
|
from enum import Enum
|
|
|
|
|
|
|
|
from pydantic import BaseModel
|
|
|
|
|
|
|
|
|
|
|
|
class HDStrategy(str, Enum):
|
2022-09-22 15:50:41 +02:00
|
|
|
ORIGINAL = "Original"
|
|
|
|
RESIZE = "Resize"
|
|
|
|
CROP = "Crop"
|
2022-04-15 18:11:51 +02:00
|
|
|
|
|
|
|
|
2022-06-12 07:14:17 +02:00
|
|
|
class LDMSampler(str, Enum):
|
2022-09-22 15:50:41 +02:00
|
|
|
ddim = "ddim"
|
|
|
|
plms = "plms"
|
2022-06-12 07:14:17 +02:00
|
|
|
|
|
|
|
|
2022-09-22 06:38:32 +02:00
|
|
|
class SDSampler(str, Enum):
|
2022-09-22 15:50:41 +02:00
|
|
|
ddim = "ddim"
|
|
|
|
pndm = "pndm"
|
2022-10-15 16:32:25 +02:00
|
|
|
k_lms = "k_lms"
|
2022-11-15 14:09:51 +01:00
|
|
|
k_euler = 'k_euler'
|
|
|
|
k_euler_a = 'k_euler_a'
|
2022-09-22 06:38:32 +02:00
|
|
|
|
|
|
|
|
2022-04-15 18:11:51 +02:00
|
|
|
class Config(BaseModel):
|
|
|
|
ldm_steps: int
|
2022-07-14 10:49:03 +02:00
|
|
|
ldm_sampler: str = LDMSampler.plms
|
|
|
|
zits_wireframe: bool = True
|
2022-04-15 18:11:51 +02:00
|
|
|
hd_strategy: str
|
|
|
|
hd_strategy_crop_margin: int
|
|
|
|
hd_strategy_crop_trigger_size: int
|
|
|
|
hd_strategy_resize_limit: int
|
2022-09-15 16:21:27 +02:00
|
|
|
|
2022-09-22 15:50:41 +02:00
|
|
|
prompt: str = ""
|
2022-11-08 14:58:48 +01:00
|
|
|
negative_prompt: str = ""
|
2022-09-15 16:21:27 +02:00
|
|
|
# 始终是在原图尺度上的值
|
|
|
|
use_croper: bool = False
|
|
|
|
croper_x: int = None
|
|
|
|
croper_y: int = None
|
|
|
|
croper_height: int = None
|
|
|
|
croper_width: int = None
|
|
|
|
|
|
|
|
# sd
|
2022-09-22 15:50:41 +02:00
|
|
|
sd_mask_blur: int = 0
|
2022-09-15 16:21:27 +02:00
|
|
|
sd_strength: float = 0.75
|
|
|
|
sd_steps: int = 50
|
|
|
|
sd_guidance_scale: float = 7.5
|
2022-09-22 06:38:32 +02:00
|
|
|
sd_sampler: str = SDSampler.ddim
|
2022-09-15 16:21:27 +02:00
|
|
|
# -1 mean random seed
|
|
|
|
sd_seed: int = 42
|
2022-10-09 15:32:13 +02:00
|
|
|
|
|
|
|
# cv2
|
|
|
|
cv2_flag: str = 'INPAINT_NS'
|
|
|
|
cv2_radius: int = 4
|