Add separate style pool config

This commit is contained in:
2026-06-28 00:24:40 +02:00
parent 4c8edc0d3e
commit 78e39734b5
18 changed files with 378 additions and 27 deletions
+19 -12
View File
@@ -8,18 +8,20 @@ try:
from . import category_library as category_policy
from . import generate_prompt_batches as g
from . import row_camera as row_camera_policy
from . import style_config as style_config_policy
except ImportError: # Allows local smoke tests from the repository root.
import category_library as category_policy
import generate_prompt_batches as g
import row_camera as row_camera_policy
import style_config as style_config_policy
GENERIC_POSITIVE_SUFFIX = (
"Use crisp clean comic linework, detailed hatching, soft blended shading, "
"pastel skin tones, muted blues and pinks, warm sensual lighting, and tactile textured paper."
"Use coherent anatomy, readable body placement, natural light response, "
"clear material texture, stable spatial depth, and polished visual detail."
)
DEFAULT_STYLE = "sexy but tasteful adult pin-up coloured-pencil comic illustration"
DEFAULT_STYLE = "realistic adult scene with natural camera realism"
@dataclass(frozen=True)
@@ -55,7 +57,7 @@ LAYOUT_TEMPLATE = (
)
DEFAULT_CAPTION_TEMPLATE = (
"{trigger}, {subject_phrase}, {age}, {item}, {scene}, {composition}, coloured pencil comic illustration"
"{trigger}, {subject_phrase}, {age}, {item}, {scene}, {composition}"
)
@@ -72,15 +74,20 @@ def format_template(template: str, context: dict[str, Any]) -> str:
return template.format_map(safe_context)
def resolve_row_text_fields(category: dict[str, Any], subcategory: dict[str, Any], item: Any) -> RowTextFields:
def resolve_row_text_fields(
category: dict[str, Any],
subcategory: dict[str, Any],
item: Any,
style_config: str | dict[str, Any] | None = None,
) -> RowTextFields:
base_negative = str(category_policy.merged_field(category, subcategory, item, "negative_prompt", g.NEGATIVE_PROMPT))
base_suffix = str(category_policy.merged_field(category, subcategory, item, "positive_suffix", GENERIC_POSITIVE_SUFFIX))
base_style = str(category_policy.merged_field(category, subcategory, item, "style", DEFAULT_STYLE))
style, positive_suffix = style_config_policy.resolve_style_fields(base_style, base_suffix, style_config)
return RowTextFields(
negative_prompt=str(
category_policy.merged_field(category, subcategory, item, "negative_prompt", g.NEGATIVE_PROMPT)
),
positive_suffix=str(
category_policy.merged_field(category, subcategory, item, "positive_suffix", GENERIC_POSITIVE_SUFFIX)
),
style=str(category_policy.merged_field(category, subcategory, item, "style", DEFAULT_STYLE)),
negative_prompt=style_config_policy.merge_negative_prompt(base_negative, style_config),
positive_suffix=positive_suffix,
style=style,
item_label=str(category_policy.merged_field(category, subcategory, item, "item_label", category["name"])),
)