Extract Insta pair camera routing

This commit is contained in:
2026-06-26 19:57:26 +02:00
parent aeea75c485
commit 1ad2015308
5 changed files with 177 additions and 66 deletions
+33 -63
View File
@@ -25,6 +25,7 @@ try:
template_list as _template_list,
)
from . import generate_prompt_batches as g
from . import pair_camera
from . import scene_camera_adapters
from .hardcore_text_cleanup import (
sanitize_hardcore_axis_values as _sanitize_hardcore_axis_values,
@@ -54,6 +55,7 @@ except ImportError: # Allows local smoke tests with `python -c`.
template_list as _template_list,
)
import generate_prompt_batches as g
import pair_camera
import scene_camera_adapters
from hardcore_text_cleanup import (
sanitize_hardcore_axis_values as _sanitize_hardcore_axis_values,
@@ -6804,12 +6806,6 @@ def _parse_insta_of_options(options_json: str | dict[str, Any] | None) -> dict[s
return parsed
def _insta_camera_config_with_detail(camera_config: dict[str, Any], camera_detail: str) -> dict[str, Any]:
if camera_detail in CAMERA_DETAIL_CHOICES:
camera_config["camera_detail"] = camera_detail
return camera_config
def _insta_of_hardcore_counts(options: dict[str, Any]) -> tuple[int, int]:
policy = str(options.get("hardcore_cast", "use_counts"))
if policy == "couple":
@@ -7448,64 +7444,38 @@ def build_insta_of_pair(
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"]]
hard_camera_mode = options["hardcore_camera_mode"]
soft_camera_source = softcore_camera_config or camera_config
hard_camera_source = hardcore_camera_config or camera_config
if hard_camera_mode == "same_as_softcore":
hard_camera_mode = options["softcore_camera_mode"]
hard_camera_source = soft_camera_source
soft_camera_config = _camera_config_with_mode(soft_camera_source, options["softcore_camera_mode"])
hard_camera_config = _camera_config_with_mode(hard_camera_source, hard_camera_mode)
soft_camera_config = _insta_camera_config_with_detail(soft_camera_config, options["camera_detail"])
hard_camera_config = _insta_camera_config_with_detail(hard_camera_config, options["camera_detail"])
soft_camera_directive, soft_camera_config = _camera_directive(soft_camera_config)
hard_camera_directive, hard_camera_config = _camera_directive(hard_camera_config)
soft_subject_kind = "woman" if options["softcore_cast"] == "solo" else "subjects"
hard_subject_kind = "couple" if hard_women_count + hard_men_count == 2 else "subjects"
soft_row = _apply_coworking_composition(soft_row, soft_subject_kind)
hard_row = _apply_coworking_composition(hard_row, hard_subject_kind)
hard_scene = soft_row["scene_text"] if options["continuity"] == "same_creator_same_room" else hard_row["scene_text"]
if hard_scene != hard_row.get("scene_text"):
hard_row["source_scene_text"] = hard_row.get("source_scene_text") or hard_row.get("scene_text", "")
hard_row["scene_text"] = hard_scene
hard_composition = _coworking_composition_prompt(hard_scene, hard_row["composition"], hard_subject_kind)
if hard_composition != hard_row["composition"]:
hard_row["source_composition"] = hard_row.get("source_composition") or hard_row["composition"]
hard_row["composition"] = hard_composition
hard_row["composition_prompt"] = _composition_prompt(hard_composition)
soft_pov_camera_labels = (
pov_character_labels
if options["softcore_cast"] == "same_as_hardcore"
else []
camera_route = pair_camera.resolve_insta_pair_camera(
soft_row=soft_row,
hard_row=hard_row,
options=options,
camera_config=camera_config,
softcore_camera_config=softcore_camera_config,
hardcore_camera_config=hardcore_camera_config,
hard_women_count=hard_women_count,
hard_men_count=hard_men_count,
pov_character_labels=pov_character_labels,
camera_detail_choices=CAMERA_DETAIL_CHOICES,
camera_config_with_mode=_camera_config_with_mode,
camera_directive=_camera_directive,
apply_contextual_composition=_apply_coworking_composition,
contextual_composition_prompt=_coworking_composition_prompt,
composition_prompt=_composition_prompt,
camera_scene_directive_for_context=_camera_scene_directive_for_context,
)
soft_camera_scene_directive, soft_camera_config = _camera_scene_directive_for_context(
soft_row.get("scene_text"),
soft_row.get("composition"),
soft_camera_config,
soft_pov_camera_labels,
soft_subject_kind,
)
hard_camera_scene_directive, hard_camera_config = _camera_scene_directive_for_context(
hard_scene,
hard_composition,
hard_camera_config,
pov_character_labels,
hard_subject_kind,
)
if soft_pov_camera_labels:
soft_camera_directive = ""
if pov_character_labels:
hard_camera_directive = ""
soft_row["camera_config"] = soft_camera_config
soft_row["camera_directive"] = soft_camera_directive
soft_row["camera_scene_directive"] = soft_camera_scene_directive
hard_row["camera_config"] = hard_camera_config
hard_row["camera_directive"] = hard_camera_directive
hard_row["camera_scene_directive"] = hard_camera_scene_directive
soft_camera_scene_sentence = f"{soft_camera_scene_directive} " if soft_camera_scene_directive else ""
hard_camera_scene_sentence = f"{hard_camera_scene_directive} " if hard_camera_scene_directive else ""
soft_camera_sentence = f"Camera control: {soft_camera_directive} " if soft_camera_directive else ""
hard_camera_sentence = f"Camera control: {hard_camera_directive} " if hard_camera_directive else ""
soft_row = camera_route["soft_row"]
hard_row = camera_route["hard_row"]
hard_scene = camera_route["hard_scene"]
hard_composition = camera_route["hard_composition"]
soft_camera_config = camera_route["soft_camera_config"]
hard_camera_config = camera_route["hard_camera_config"]
soft_camera_directive = camera_route["soft_camera_directive"]
hard_camera_directive = camera_route["hard_camera_directive"]
soft_camera_scene_directive = camera_route["soft_camera_scene_directive"]
hard_camera_scene_directive = camera_route["hard_camera_scene_directive"]
soft_camera_scene_sentence = camera_route["soft_camera_scene_sentence"]
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"