Add SDXL formatter profiles

This commit is contained in:
2026-06-27 01:49:39 +02:00
parent 21da2949c6
commit 5ab2433ca7
8 changed files with 130 additions and 8 deletions
+38
View File
@@ -3,6 +3,7 @@ from __future__ import annotations
DEFAULT_STYLE_PRESET = "flat_vector_pony"
DEFAULT_QUALITY_PRESET = "pony_high"
DEFAULT_FORMATTER_PROFILE = "manual_controls"
SDXL_STYLE_PRESETS = {
"flat_vector_pony": "(skindentation:1.25), (flat color:2.0), no lineart, no outline, Flat vector",
@@ -21,6 +22,22 @@ SDXL_QUALITY_PRESETS = {
"none": "",
}
SDXL_FORMATTER_PROFILES = {
"manual_controls": {},
"pony_flat_vector": {
"style_preset": "flat_vector_pony",
"quality_preset": "pony_high",
},
"sdxl_photo": {
"style_preset": "photographic",
"quality_preset": "sdxl_high",
},
"flat_vector": {
"style_preset": "flat_vector",
"quality_preset": "sdxl_high",
},
}
SDXL_DEFAULT_NEGATIVE = (
"worst quality, low quality, normal quality, lowres, bad anatomy, bad hands, "
"extra fingers, missing fingers, fused fingers, deformed, disfigured, malformed body, "
@@ -58,9 +75,30 @@ def sdxl_quality_preset_choices() -> list[str]:
return list(SDXL_QUALITY_PRESETS)
def sdxl_formatter_profile_choices() -> list[str]:
return list(SDXL_FORMATTER_PROFILES)
def normalize_style_preset(value: str) -> str:
return value if value in SDXL_STYLE_PRESETS else DEFAULT_STYLE_PRESET
def normalize_quality_preset(value: str) -> str:
return value if value in SDXL_QUALITY_PRESETS else DEFAULT_QUALITY_PRESET
def normalize_formatter_profile(value: str) -> str:
return value if value in SDXL_FORMATTER_PROFILES else DEFAULT_FORMATTER_PROFILE
def apply_formatter_profile(
formatter_profile: str,
*,
style_preset: str,
quality_preset: str,
) -> tuple[str, str]:
profile = SDXL_FORMATTER_PROFILES[normalize_formatter_profile(formatter_profile)]
return (
normalize_style_preset(profile.get("style_preset", style_preset)),
normalize_quality_preset(profile.get("quality_preset", quality_preset)),
)