Naturalize Krea single appearance phrasing
This commit is contained in:
@@ -80,6 +80,16 @@ def _framed_composition_phrase(composition: str, prefix: str = "framed as") -> s
|
|||||||
return f"{prefix} {composition}"
|
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(
|
def format_normal_row_result(
|
||||||
request: KreaNormalRowRequest,
|
request: KreaNormalRowRequest,
|
||||||
deps: KreaNormalRowDependencies,
|
deps: KreaNormalRowDependencies,
|
||||||
@@ -100,9 +110,12 @@ def format_normal_row_result(
|
|||||||
if primary in ("woman", "man") or subject_type in ("woman", "man", "single_any"):
|
if primary in ("woman", "man") or subject_type in ("woman", "man", "single_any"):
|
||||||
subject = deps.age_subject(row, "adult woman")
|
subject = deps.age_subject(row, "adult woman")
|
||||||
appearance = deps.appearance_phrase(row)
|
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 = [
|
parts = [
|
||||||
deps.with_indefinite_article(subject),
|
subject_phrase,
|
||||||
f"showing {appearance}" if appearance else "",
|
|
||||||
f"wearing {item}" if item else "",
|
f"wearing {item}" if item else "",
|
||||||
f"{pose}" if pose else "",
|
f"{pose}" if pose else "",
|
||||||
f"with {expression}" if expression else "",
|
f"with {expression}" if expression else "",
|
||||||
|
|||||||
@@ -1447,8 +1447,12 @@ def smoke_krea_normal_row_routes() -> None:
|
|||||||
"Krea single route kept old comma-with figure grammar",
|
"Krea single route kept old comma-with figure grammar",
|
||||||
)
|
)
|
||||||
_expect(
|
_expect(
|
||||||
"adult woman, showing slim busty figure with" in figure_note_prompt,
|
"adult woman with a slim busty figure with" in figure_note_prompt,
|
||||||
"Krea single route did not naturalize figure-note appearance",
|
"Krea single route did not attach figure-note appearance to the subject",
|
||||||
|
)
|
||||||
|
_expect(
|
||||||
|
"adult woman, showing slim busty figure with" not in figure_note_prompt,
|
||||||
|
"Krea single route kept awkward showing figure-note grammar",
|
||||||
)
|
)
|
||||||
style_metadata = dict(
|
style_metadata = dict(
|
||||||
single,
|
single,
|
||||||
|
|||||||
Reference in New Issue
Block a user