Improve paired cast continuity and wording
This commit is contained in:
+75
-2
@@ -1079,6 +1079,18 @@ def _merged_field(category: dict[str, Any], subcategory: dict[str, Any], item: A
|
||||
return default
|
||||
|
||||
|
||||
def _body_phrase(body: Any, figure_note: Any = "") -> str:
|
||||
body = str(body or "").strip()
|
||||
figure_note = str(figure_note or "").strip()
|
||||
if not body:
|
||||
return figure_note
|
||||
if not figure_note:
|
||||
return f"{body} figure"
|
||||
if "figure" in figure_note.lower():
|
||||
return f"{body} build and {figure_note}"
|
||||
return f"{body} figure with {figure_note}"
|
||||
|
||||
|
||||
def _appearance_for_subject(
|
||||
rng: random.Random,
|
||||
subject_type: str,
|
||||
@@ -1116,7 +1128,7 @@ def _appearance_for_subject(
|
||||
"skin": skin,
|
||||
"hair": hair,
|
||||
"eyes": eyes,
|
||||
"body_phrase": f"{body} figure with {figure_note}",
|
||||
"body_phrase": _body_phrase(body, figure_note),
|
||||
"figure": figure_note,
|
||||
}
|
||||
|
||||
@@ -1187,7 +1199,7 @@ def _configured_cast_context(women_count: int, men_count: int) -> dict[str, str]
|
||||
|
||||
def _lettered(prefix: str, count: int) -> list[str]:
|
||||
letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
return [f"{prefix} {letters[index]}" for index in range(max(0, count))]
|
||||
return [f"{prefix.capitalize()} {letters[index]}" for index in range(max(0, count))]
|
||||
|
||||
|
||||
def _pick_distinct(rng: random.Random, items: list[str], count: int) -> list[str]:
|
||||
@@ -2017,6 +2029,46 @@ def _insta_of_descriptor(row: dict[str, Any]) -> str:
|
||||
return ", ".join(str(piece).strip() for piece in pieces if piece and str(piece).strip())
|
||||
|
||||
|
||||
def _insta_of_descriptor_from_context(context: dict[str, Any]) -> str:
|
||||
age = str(context.get("age") or "").strip()
|
||||
age = " ".join(age.split())
|
||||
age = age.removesuffix(" adults").removesuffix(" adult").strip()
|
||||
subject = str(context.get("subject") or context.get("subject_type") or "person").strip()
|
||||
pieces = [
|
||||
f"{age} adult {subject}".strip(),
|
||||
context.get("body_phrase"),
|
||||
context.get("skin"),
|
||||
context.get("hair"),
|
||||
context.get("eyes"),
|
||||
]
|
||||
return ", ".join(str(piece).strip() for piece in pieces if piece and str(piece).strip())
|
||||
|
||||
|
||||
def _insta_of_cast_descriptors(
|
||||
primary_descriptor: str,
|
||||
seed_config: dict[str, int],
|
||||
seed: int,
|
||||
row_number: int,
|
||||
ethnicity: str,
|
||||
figure: str,
|
||||
no_plus_women: bool,
|
||||
no_black: bool,
|
||||
women_count: int,
|
||||
men_count: int,
|
||||
) -> list[str]:
|
||||
descriptors = [f"Woman A / primary creator: {primary_descriptor}"]
|
||||
rng = _axis_rng(seed_config, "person", seed, row_number + 997)
|
||||
for index in range(max(0, women_count - 1)):
|
||||
label = chr(ord("B") + index)
|
||||
context = _appearance_for_subject(rng, "woman", ethnicity, figure, no_plus_women, no_black)
|
||||
descriptors.append(f"Woman {label}: {_insta_of_descriptor_from_context(context)}")
|
||||
for index in range(max(0, men_count)):
|
||||
label = chr(ord("A") + index)
|
||||
context = _appearance_for_subject(rng, "man", ethnicity, figure, no_plus_women, no_black)
|
||||
descriptors.append(f"Man {label}: {_insta_of_descriptor_from_context(context)}")
|
||||
return descriptors
|
||||
|
||||
|
||||
def _insta_of_cast_phrase(women_count: int, men_count: int) -> str:
|
||||
context = _configured_cast_context(women_count, men_count)
|
||||
return context["cast_summary"]
|
||||
@@ -2097,6 +2149,24 @@ def build_insta_of_pair(
|
||||
)
|
||||
|
||||
descriptor = _insta_of_descriptor(soft_row)
|
||||
cast_descriptors = _insta_of_cast_descriptors(
|
||||
descriptor,
|
||||
parsed_seed_config,
|
||||
seed,
|
||||
row_number,
|
||||
ethnicity,
|
||||
figure,
|
||||
no_plus_women,
|
||||
no_black,
|
||||
hard_women_count,
|
||||
hard_men_count,
|
||||
)
|
||||
cast_descriptor_text = "; ".join(cast_descriptors)
|
||||
soft_cast_descriptor_text = (
|
||||
cast_descriptor_text
|
||||
if options["softcore_cast"] == "same_as_hardcore"
|
||||
else f"Woman A / primary creator: {descriptor}"
|
||||
)
|
||||
platform_style = INSTA_OF_PLATFORM_STYLES[options["platform_style"]]
|
||||
soft_level = INSTA_OF_SOFT_LEVELS[options["softcore_level"]]
|
||||
hard_level = INSTA_OF_HARDCORE_LEVELS[options["hardcore_level"]]
|
||||
@@ -2121,6 +2191,7 @@ def build_insta_of_pair(
|
||||
soft_prompt = (
|
||||
f"Insta/OF softcore mode: {platform_style}. Shared primary creator descriptor: {descriptor}. "
|
||||
f"Softcore setup: {soft_level}. Cast continuity: {soft_cast}. "
|
||||
f"Shared cast descriptors: {soft_cast_descriptor_text}. "
|
||||
f"Outfit: {soft_row['item']}. Pose: {soft_row['pose']}. Setting: {soft_row['scene_text']}. "
|
||||
f"Facial expression: {soft_row['expression']}. Composition: {soft_row['composition']}. "
|
||||
f"{soft_camera_sentence}"
|
||||
@@ -2130,6 +2201,7 @@ def build_insta_of_pair(
|
||||
hard_prompt = (
|
||||
f"Insta/OF hardcore mode: {platform_style}. Shared primary creator descriptor: {descriptor}. "
|
||||
f"Hardcore setup: {hard_level}. Cast: {hard_cast}. "
|
||||
f"Shared cast descriptors: {cast_descriptor_text}. "
|
||||
"Apply the shared descriptor to the most visually central woman, keeping her continuous with the softcore version. "
|
||||
f"Role graph: {hard_row['role_graph']} Sexual scene: {hard_row['item']}. "
|
||||
f"Setting: {hard_scene}. Facial expressions: {hard_row['expression']}. Composition: {hard_composition}. "
|
||||
@@ -2159,6 +2231,7 @@ def build_insta_of_pair(
|
||||
"mode": "Insta/OF",
|
||||
"options": options,
|
||||
"shared_descriptor": descriptor,
|
||||
"shared_cast_descriptors": cast_descriptors,
|
||||
"softcore_prompt": soft_prompt,
|
||||
"hardcore_prompt": hard_prompt,
|
||||
"softcore_negative_prompt": soft_negative,
|
||||
|
||||
Reference in New Issue
Block a user