Extract Insta pair cast context

This commit is contained in:
2026-06-26 22:18:59 +02:00
parent b7939a4748
commit 9b9b0cbb4c
5 changed files with 175 additions and 78 deletions
+38 -62
View File
@@ -27,6 +27,7 @@ try:
from . import generate_prompt_batches as g
from . import pair_clothing
from . import pair_camera
from . import pair_cast
from . import pair_output
from . import pair_rows
from . import scene_camera_adapters
@@ -60,6 +61,7 @@ except ImportError: # Allows local smoke tests with `python -c`.
import generate_prompt_batches as g
import pair_clothing
import pair_camera
import pair_cast
import pair_output
import pair_rows
import scene_camera_adapters
@@ -7037,41 +7039,38 @@ def build_insta_of_pair(
hard_row = row_route["hard_row"]
hard_content_rng = row_route["hard_content_rng"]
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,
character_slots,
cast_context = pair_cast.resolve_insta_pair_cast_context(
soft_row=soft_row,
options=options,
parsed_seed_config=parsed_seed_config,
seed=seed,
row_number=row_number,
ethnicity=ethnicity,
figure=figure,
no_plus_women=no_plus_women,
no_black=no_black,
hard_women_count=hard_women_count,
hard_men_count=hard_men_count,
character_slots=character_slots,
character_slot_map=character_slot_map,
pov_character_labels=pov_character_labels,
platform_styles=INSTA_OF_PLATFORM_STYLES,
soft_levels=INSTA_OF_SOFT_LEVELS,
hardcore_levels=INSTA_OF_HARDCORE_LEVELS,
descriptor_from_row=_insta_of_descriptor,
build_cast_descriptors=_insta_of_cast_descriptors,
prompt_cast_descriptors=_insta_of_prompt_cast_descriptors,
partner_styling=_insta_of_partner_styling,
cast_phrase=_insta_of_cast_phrase,
)
cast_descriptor_text = _insta_of_prompt_cast_descriptors("; ".join(cast_descriptors))
soft_cast_descriptor_text = (
cast_descriptor_text
if options["softcore_cast"] == "same_as_hardcore"
else f"Woman A: {descriptor}"
)
soft_partner_styling = _insta_of_partner_styling(
parsed_seed_config,
seed,
row_number,
hard_women_count if options["softcore_cast"] == "same_as_hardcore" else 1,
hard_men_count if options["softcore_cast"] == "same_as_hardcore" else 0,
pov_character_labels if options["softcore_cast"] == "same_as_hardcore" else [],
character_slot_map,
)
if options["softcore_cast"] != "same_as_hardcore":
soft_partner_styling = {"outfits": [], "pose": ""}
soft_partner_outfit_text = "; ".join(soft_partner_styling["outfits"])
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"]]
descriptor = cast_context["descriptor"]
cast_descriptors = cast_context["cast_descriptors"]
cast_descriptor_text = cast_context["cast_descriptor_text"]
soft_partner_styling = cast_context["soft_partner_styling"]
soft_partner_outfit_text = cast_context["soft_partner_outfit_text"]
platform_style = cast_context["platform_style"]
soft_level = cast_context["soft_level"]
hard_level = cast_context["hard_level"]
camera_route = pair_camera.resolve_insta_pair_camera(
soft_row=soft_row,
hard_row=hard_row,
@@ -7104,29 +7103,10 @@ def build_insta_of_pair(
hard_camera_scene_sentence = camera_route["hard_camera_scene_sentence"]
soft_camera_sentence = camera_route["soft_camera_sentence"]
hard_camera_sentence = camera_route["hard_camera_sentence"]
soft_cast = (
"solo creator setup with Woman A alone"
if options["softcore_cast"] == "solo"
else f"soft creator-teaser setup with {_insta_of_cast_phrase(hard_women_count, hard_men_count)}"
)
soft_cast_presence = (
(
"Frame Woman A from the POV participant's first-person camera in a soft creator-teaser setup; "
"keep the POV participant off-camera as the viewpoint and implied by camera perspective or foreground cues. "
)
if options["softcore_cast"] == "same_as_hardcore" and pov_character_labels
else (
"Place Woman A and the listed partners together in a soft creator-teaser pose. "
if options["softcore_cast"] == "same_as_hardcore"
else "Keep the softcore version focused on Woman A alone. "
)
)
soft_cast_styling_sentence = (
f"Partner softcore styling: {soft_partner_outfit_text}. Cast pose: {soft_partner_styling['pose']}. "
if options["softcore_cast"] == "same_as_hardcore" and soft_partner_outfit_text
else ""
)
hard_cast = _insta_of_cast_phrase(hard_women_count, hard_men_count)
soft_cast = cast_context["soft_cast"]
soft_cast_presence = cast_context["soft_cast_presence"]
soft_cast_styling_sentence = cast_context["soft_cast_styling_sentence"]
hard_cast = cast_context["hard_cast"]
character_hardcore_clothing_entries = _character_hardcore_clothing_entries(
character_slot_map,
hard_women_count,
@@ -7160,11 +7140,7 @@ def build_insta_of_pair(
"dense": "Use dense but coherent motion, contact, and aftermath detail while keeping one readable body position. ",
}[hard_detail_density]
pov_directive = _pov_prompt_directive(pov_character_labels)
soft_descriptor_sentence = (
f"Cast descriptors: {soft_cast_descriptor_text}. "
if options["softcore_cast"] == "same_as_hardcore"
else f"Woman A: {descriptor}. "
)
soft_descriptor_sentence = cast_context["soft_descriptor_sentence"]
return pair_output.assemble_insta_pair_metadata(
active_trigger=active_trigger,