Add prompt control and filter options
This commit is contained in:
+52
-18
@@ -164,6 +164,10 @@ def _combine_negative(*parts: str) -> str:
|
||||
return ", ".join(cleaned)
|
||||
|
||||
|
||||
def _prompt_cast_descriptors(text: str) -> str:
|
||||
return _clean(text).replace("Woman A / primary creator:", "Woman A:")
|
||||
|
||||
|
||||
def _clean_age(age: Any) -> str:
|
||||
return _clean(age)
|
||||
|
||||
@@ -205,15 +209,50 @@ def _camera_phrase(row: dict[str, Any]) -> str:
|
||||
return directive
|
||||
config = row.get("camera_config")
|
||||
if isinstance(config, dict):
|
||||
detail = _clean(config.get("camera_detail"))
|
||||
if detail == "off" or _clean(config.get("camera_mode")) == "disabled":
|
||||
return ""
|
||||
mode = _clean(config.get("camera_mode")).replace("_", " ")
|
||||
shot = _clean(config.get("shot_size")).replace("_", " ")
|
||||
angle = _clean(config.get("angle")).replace("_", " ")
|
||||
pieces = [piece for piece in (mode, shot, angle) if piece and piece != "auto" and piece != "standard"]
|
||||
if pieces:
|
||||
return "Camera framing uses " + ", ".join(pieces)
|
||||
return "Camera: " + ", ".join(pieces)
|
||||
return ""
|
||||
|
||||
|
||||
def _camera_phrase_from_config(config: Any) -> str:
|
||||
if not isinstance(config, dict):
|
||||
return ""
|
||||
detail = _clean(config.get("camera_detail"))
|
||||
if detail == "off" or _clean(config.get("camera_mode")) == "disabled":
|
||||
return ""
|
||||
values = [
|
||||
_clean(config.get("camera_mode")).replace("_", " "),
|
||||
_clean(config.get("shot_size")).replace("_", " "),
|
||||
_clean(config.get("angle")).replace("_", " "),
|
||||
_clean(config.get("lens")).replace("_", " "),
|
||||
_clean(config.get("distance")).replace("_", " "),
|
||||
_clean(config.get("orientation")).replace("_", " "),
|
||||
_clean(config.get("phone_visibility")).replace("_", " "),
|
||||
]
|
||||
pieces = [value for value in values if value and value not in ("auto", "standard")]
|
||||
if not pieces:
|
||||
return ""
|
||||
return "Camera: " + ", ".join(pieces)
|
||||
|
||||
|
||||
def _pair_camera_phrase(directive: Any, config: Any, row: dict[str, Any]) -> str:
|
||||
directive_text = _clean(directive)
|
||||
if directive_text:
|
||||
return directive_text
|
||||
if isinstance(config, dict) and (
|
||||
_clean(config.get("camera_detail")) == "off" or _clean(config.get("camera_mode")) == "disabled"
|
||||
):
|
||||
return ""
|
||||
return _camera_phrase_from_config(config) or _camera_phrase(row)
|
||||
|
||||
|
||||
def _style_phrase(row: dict[str, Any], style_mode: str) -> str:
|
||||
if style_mode == "minimal":
|
||||
return ""
|
||||
@@ -323,31 +362,27 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
|
||||
cast_descriptor_text = "; ".join(_clean(item) for item in cast_descriptors if _clean(item))
|
||||
else:
|
||||
cast_descriptor_text = _clean(cast_descriptors)
|
||||
cast_descriptor_text = _prompt_cast_descriptors(cast_descriptor_text)
|
||||
soft = row.get("softcore_row") if isinstance(row.get("softcore_row"), dict) else {}
|
||||
hard = row.get("hardcore_row") if isinstance(row.get("hardcore_row"), dict) else {}
|
||||
soft_camera = _clean(row.get("softcore_camera_directive")) or _camera_phrase(soft)
|
||||
hard_camera = _clean(row.get("hardcore_camera_directive")) or _camera_phrase(hard)
|
||||
soft_camera = _pair_camera_phrase(row.get("softcore_camera_directive"), row.get("softcore_camera_config"), soft)
|
||||
hard_camera = _pair_camera_phrase(row.get("hardcore_camera_directive"), row.get("hardcore_camera_config"), hard)
|
||||
soft_style = _style_phrase(soft, style_mode)
|
||||
hard_style = _style_phrase(hard, style_mode)
|
||||
options = row.get("options") if isinstance(row.get("options"), dict) else {}
|
||||
soft_level = _clean(options.get("softcore_level")).replace("_", " ")
|
||||
hard_level = _clean(options.get("hardcore_level")).replace("_", " ")
|
||||
hard_cast = _clean(row.get("hardcore_women_count"))
|
||||
hard_men = _clean(row.get("hardcore_men_count"))
|
||||
hard_cast_text = _clean(hard.get("cast_summary")) or (
|
||||
f"{hard_cast} adult women and {hard_men} adult men" if hard_cast or hard_men else ""
|
||||
)
|
||||
same_room = options.get("continuity") == "same_creator_same_room"
|
||||
hard_scene = soft.get("scene_text") if same_room and soft.get("scene_text") else hard.get("scene_text")
|
||||
hard_composition = soft.get("composition") if same_room and soft.get("composition") else hard.get("composition")
|
||||
hard_composition = hard.get("composition")
|
||||
soft_cast_descriptor_text = (
|
||||
cast_descriptor_text
|
||||
if options.get("softcore_cast") == "same_as_hardcore"
|
||||
else f"Woman A / primary creator: {descriptor}"
|
||||
else f"Woman A: {descriptor}"
|
||||
)
|
||||
same_soft_cast = options.get("softcore_cast") == "same_as_hardcore"
|
||||
soft_cast_presence = (
|
||||
"The same cast is present together in a non-explicit teaser pose, with no sex act or genital contact"
|
||||
"Woman A and the listed partners are present together in a non-explicit teaser pose, with no sex act or genital contact"
|
||||
if same_soft_cast
|
||||
else "The softcore version focuses on Woman A alone"
|
||||
)
|
||||
@@ -361,12 +396,11 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
|
||||
partner_pose = ""
|
||||
|
||||
soft_parts = [
|
||||
descriptor,
|
||||
f"Shared cast descriptors: {soft_cast_descriptor_text}" if same_soft_cast and soft_cast_descriptor_text else "",
|
||||
f"Softcore primary creator descriptor: {soft_cast_descriptor_text}" if not same_soft_cast and soft_cast_descriptor_text else "",
|
||||
f"Cast descriptors: {soft_cast_descriptor_text}" if same_soft_cast and soft_cast_descriptor_text else "",
|
||||
soft_cast_descriptor_text if not same_soft_cast and soft_cast_descriptor_text else "",
|
||||
soft_cast_presence,
|
||||
f"Partner softcore styling: {partner_outfit_text}" if partner_outfit_text else "",
|
||||
f"The shared softcore cast pose is {partner_pose}" if partner_pose else "",
|
||||
f"Cast pose: {partner_pose}" if partner_pose else "",
|
||||
f"shown in a {soft_level or 'softcore'} Insta/OF creator image",
|
||||
f"wearing {soft.get('item')}" if soft.get("item") else "",
|
||||
f"{soft.get('pose')}" if soft.get("pose") else "",
|
||||
@@ -377,9 +411,9 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
|
||||
soft_style if detail_level != "concise" else "",
|
||||
]
|
||||
hard_parts = [
|
||||
f"The primary creator remains {descriptor}, visually central in a {hard_level or 'hardcore'} scene",
|
||||
f"{'Shared' if same_soft_cast else 'Hardcore'} cast descriptors: {cast_descriptor_text}" if cast_descriptor_text else "",
|
||||
f"The cast includes {hard_cast_text}" if hard_cast_text else "",
|
||||
f"{hard_level or 'hardcore'} scene with Woman A visually central",
|
||||
f"Cast descriptors: {cast_descriptor_text}" if cast_descriptor_text else "",
|
||||
_clean(row.get("hardcore_clothing_state")),
|
||||
_clean(hard.get("role_graph")),
|
||||
f"The sexual action is {hard.get('item')}" if hard.get("item") else "",
|
||||
f"set in {hard_scene}" if hard_scene else "",
|
||||
|
||||
Reference in New Issue
Block a user