Naturalize Krea single appearance phrasing

This commit is contained in:
2026-06-27 21:49:15 +02:00
parent a4b4dae8cf
commit 221659a58d
2 changed files with 21 additions and 4 deletions
+15 -2
View File
@@ -80,6 +80,16 @@ def _framed_composition_phrase(composition: str, prefix: str = "framed as") -> s
return f"{prefix} {composition}"
def _appearance_with_phrase(appearance: str, with_indefinite_article: Callable[[str], str]) -> str:
appearance = str(appearance or "").strip()
if not appearance:
return ""
first_clause = appearance.split(",", 1)[0].lower()
if re.search(r"\b(?:body|build|figure|frame|physique|silhouette)\b", first_clause):
appearance = with_indefinite_article(appearance)
return f"with {appearance}"
def format_normal_row_result(
request: KreaNormalRowRequest,
deps: KreaNormalRowDependencies,
@@ -100,9 +110,12 @@ def format_normal_row_result(
if primary in ("woman", "man") or subject_type in ("woman", "man", "single_any"):
subject = deps.age_subject(row, "adult woman")
appearance = deps.appearance_phrase(row)
subject_phrase = deps.with_indefinite_article(subject)
appearance_phrase = _appearance_with_phrase(appearance, deps.with_indefinite_article)
if appearance_phrase:
subject_phrase = f"{subject_phrase} {appearance_phrase}"
parts = [
deps.with_indefinite_article(subject),
f"showing {appearance}" if appearance else "",
subject_phrase,
f"wearing {item}" if item else "",
f"{pose}" if pose else "",
f"with {expression}" if expression else "",