Remove softcore and hardcore scene leaks

This commit is contained in:
2026-06-24 20:44:56 +02:00
parent aca1e2f421
commit 4172797b43
2 changed files with 180 additions and 40 deletions
+80 -10
View File
@@ -41,6 +41,68 @@ def _clean(value: Any) -> str:
return text
HARDCORE_ENVIRONMENT_ANCHOR_REPLACEMENTS = (
(r"\bstacked bodies on the bed\b", "stacked bodies with close body alignment"),
(r"\bthree bodies tangled on the bed\b", "three bodies tangled in close contact"),
(r"\ba triangle of bodies on the mattress\b", "a triangle of bodies in close contact"),
(r"\bbodies tangled on the sheets\b", "bodies tangled in close contact"),
(r"\bwet bodies tangled on sheets\b", "wet bodies tangled in close contact"),
(r"\bbody arched on rumpled sheets\b", "body arched with clear skin contact"),
(r"\bface-down ass-up on the mattress\b", "face-down ass-up position"),
(r"\bsitting on the edge of the bed\b", "sitting on a raised edge"),
(r"\blying at the bed edge with thighs open\b", "lying near a raised edge with thighs open"),
(r"\bedge[- ]of[- ]bed\b", "edge-supported"),
(r"\bbed[- ]edge\b", "edge-supported"),
(r"\bedge of (?:the )?bed\b", "raised edge"),
(r"\bbed edge\b", "raised edge"),
(r"\bhands? braced on the bed\b", "hands braced beside the body"),
(r"\bone hand pressing into the mattress\b", "one hand braced beside the body"),
(r"\bone foot planted on the bed\b", "one foot planted for leverage"),
(r"\bfingers gripping sheets and skin\b", "fingers gripping skin"),
(r"\bfingers gripping sheets\b", "fingers gripping skin"),
(r"\bhands gripping sheets\b", "hands gripping skin"),
(r"\bone hand gripping the sheets\b", "one hand gripping skin"),
(r"\brumpled bed sheets\b", "wrinkled body-contact fabric"),
(r"\bwet sheets beneath the bodies\b", "visible wetness beneath the bodies"),
(r"\bsexual fluids on sheets\b", "sexual fluids visible on skin"),
(r"\bcum dripping onto sheets\b", "cum visible on skin"),
(r"\bfluid dripping onto sheets\b", "fluid visible on skin"),
(r"\bsquirting fluid on the sheets\b", "squirting fluid visible on skin"),
(r"\bsoft sheets\b", "soft fabric"),
(r"\bsilk sheets\b", "silk fabric"),
(r"\bsheets\b", "fabric"),
(r"\bmattress\b", "low support surface"),
(r"\ba low support surface\b", "a low body support"),
(r"\ba low mattress\b", "a low body support"),
(r"\ba wide couch\b", "a wide body support"),
(r"\bwide couch\b", "wide body support"),
(r"\bcouch\b", "body support"),
(r"\bsofa\b", "body support"),
(r"\bon the bed\b", "on a body support"),
(r"\bon a bed\b", "on a body support"),
(r"\bbedroom-floor\b", "floor-level"),
(r"\bbedroom floor\b", "floor-level"),
)
def _sanitize_hardcore_environment_anchors(value: Any) -> str:
text = _clean(value)
if not text:
return ""
for pattern, replacement in HARDCORE_ENVIRONMENT_ANCHOR_REPLACEMENTS:
text = re.sub(pattern, replacement, text, flags=re.IGNORECASE)
text = re.sub(r"\s+,", ",", text)
text = re.sub(r",\s*,", ",", text)
text = re.sub(r"\s{2,}", " ", text)
return text.strip()
def _sanitize_hardcore_axis_values(values: Any) -> dict[str, str]:
if not isinstance(values, dict):
return {}
return {str(key): _sanitize_hardcore_environment_anchors(value) for key, value in values.items()}
def _is_false(value: Any) -> bool:
if isinstance(value, bool):
return value is False
@@ -1435,11 +1497,16 @@ def _normal_row_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
cast_labels = _merge_labels(cast_labels, pov_labels)
expression = _filter_pov_labeled_clauses(expression, pov_labels)
expression = _natural_label_text(expression, cast_labels)
role_graph = _sanitize_scene_text_for_cast(row.get("source_role_graph") or row.get("role_graph"), cast_labels)
item = _sanitize_scene_text_for_cast(item, cast_labels)
composition = _sanitize_hardcore_environment_anchors(composition)
source_composition = _sanitize_hardcore_environment_anchors(source_composition)
role_graph = _sanitize_scene_text_for_cast(
_sanitize_hardcore_environment_anchors(row.get("source_role_graph") or row.get("role_graph")),
cast_labels,
)
item = _sanitize_scene_text_for_cast(_sanitize_hardcore_environment_anchors(item), cast_labels)
role_graph = _natural_label_text(role_graph, cast_labels)
item = _natural_label_text(item, cast_labels)
axis_values = row.get("item_axis_values") if isinstance(row.get("item_axis_values"), dict) else {}
axis_values = _sanitize_hardcore_axis_values(row.get("item_axis_values"))
detail_density = _normalize_hardcore_detail_density(row.get("hardcore_detail_density"))
action = _hardcore_action_sentence(role_graph, item, source_composition, axis_values, detail_density)
action = _pov_action_phrase(action, pov_labels)
@@ -1526,8 +1593,8 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
hard_level = _clean(options.get("hardcore_level")).replace("_", " ")
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 = hard.get("composition")
hard_source_composition = hard.get("source_composition") or hard_composition
hard_composition = _sanitize_hardcore_environment_anchors(hard.get("composition"))
hard_source_composition = _sanitize_hardcore_environment_anchors(hard.get("source_composition") or hard_composition)
pov_labels = _merge_labels(
_pov_labels_from_value(row.get("pov_character_labels")),
_pov_labels_from_value(soft.get("pov_character_labels")),
@@ -1545,11 +1612,14 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
hard_cast_prose, hard_labels = _cast_prose(cast_descriptor_text, omit_labels=pov_labels)
soft_labels = _merge_labels(soft_labels, pov_labels if options.get("softcore_cast") == "same_as_hardcore" else [])
hard_labels = _merge_labels(hard_labels, pov_labels)
hard_item = _sanitize_scene_text_for_cast(hard.get("item"), hard_labels)
hard_role_graph = _sanitize_scene_text_for_cast(hard.get("source_role_graph") or hard.get("role_graph"), hard_labels)
hard_item = _sanitize_scene_text_for_cast(_sanitize_hardcore_environment_anchors(hard.get("item")), hard_labels)
hard_role_graph = _sanitize_scene_text_for_cast(
_sanitize_hardcore_environment_anchors(hard.get("source_role_graph") or hard.get("role_graph")),
hard_labels,
)
hard_item = _natural_label_text(hard_item, hard_labels)
hard_role_graph = _natural_label_text(hard_role_graph, hard_labels)
hard_axis_values = hard.get("item_axis_values") if isinstance(hard.get("item_axis_values"), dict) else {}
hard_axis_values = _sanitize_hardcore_axis_values(hard.get("item_axis_values"))
hard_detail_density = _normalize_hardcore_detail_density(
hard.get("hardcore_detail_density") or row.get("hardcore_detail_density") or options.get("hardcore_detail_density")
)
@@ -1566,12 +1636,12 @@ def _insta_pair_to_krea(row: dict[str, Any], detail_level: str, style_mode: str)
soft_output_composition = _pov_composition_text(soft.get("composition"), pov_labels if same_soft_cast else [])
if same_soft_cast and pov_labels:
soft_cast_presence = (
"the woman is framed from the POV participant's first-person camera in a non-explicit teaser pose, "
"the woman is framed from the POV participant's first-person camera in a soft creator-teaser pose, "
"with the POV participant kept off-camera as the viewpoint and implied by camera position or foreground cues"
)
else:
soft_cast_presence = (
f"{_label_join(soft_labels)} are together in a non-explicit teaser pose, with no sex act or genital contact"
f"{_label_join(soft_labels)} share the frame in a soft creator-teaser pose"
if same_soft_cast
else "The image focuses on the woman alone"
)