Naturalize Krea single appearance grammar

This commit is contained in:
2026-06-27 21:34:15 +02:00
parent 4f97057fc4
commit e9bd9c45ca
3 changed files with 30 additions and 1 deletions
+11
View File
@@ -536,6 +536,16 @@ def _caption_expression_grammar_issues(name: str, caption_text: str) -> list[str
return []
def _krea_grammar_issues(name: str, krea_prompt: str) -> list[str]:
if re.search(
r"\b(?:woman|man|person),\s+with\s+[^.;]{0,120}\bfigure\s+with\b",
krea_prompt,
flags=re.IGNORECASE,
):
return [f"{name}.krea_prompt: subject_appearance_with_grammar"]
return []
def _trace_dict(formatter_name: str, payload: dict[str, Any]) -> tuple[dict[str, Any], str]:
trace_text = str(payload.get("route_trace_json") or "")
if not trace_text:
@@ -670,6 +680,7 @@ def _formatter_issues(
issues.extend(_formatter_trace_issues(name, formats, target=target, row=row))
issues.extend(_caption_cast_descriptor_issues(name, row, caption_text))
issues.extend(_caption_expression_grammar_issues(name, caption_text))
issues.extend(_krea_grammar_issues(name, krea_prompt))
for label, value in (
(f"{name}.krea_negative", krea.get("negative_prompt")),
+18
View File
@@ -1432,6 +1432,24 @@ def smoke_krea_normal_row_routes() -> None:
"style": "realistic creator-shot photography",
}
_expect_krea_normal_route_parity(single, "krea_normal_single", "metadata(single)")
single_figure_note = dict(
single,
body_phrase="slim busty figure with soft, natural fullness up top and a small waist",
)
figure_note_prompt, figure_note_method = krea_formatter._normal_row_to_krea(
single_figure_note,
"balanced",
"preserve",
)
_expect(figure_note_method == "metadata(single)", "Krea single figure-note route changed method")
_expect(
"adult woman, with slim busty figure with" not in figure_note_prompt,
"Krea single route kept old comma-with figure grammar",
)
_expect(
"adult woman, showing slim busty figure with" in figure_note_prompt,
"Krea single route did not naturalize figure-note appearance",
)
style_metadata = dict(
single,
style="metadata style phrase",