diff --git a/krea_formatter.py b/krea_formatter.py index c57eb07..7a645e2 100644 --- a/krea_formatter.py +++ b/krea_formatter.py @@ -324,14 +324,30 @@ def _expression_phrase(expression: Any) -> str: expression, flags=re.IGNORECASE, ): - return f"Expressions: {expression}" + expression = re.sub( + r"\b((?:Woman|Man) [A-Z]|the (?:woman|man)) has\b", + r"\1 showing", + expression, + flags=re.IGNORECASE, + ) + return f"With {expression[:1].lower()}{expression[1:]}" return f"with {expression}" +def _natural_camera_phrase(value: str) -> str: + value = _clean(value) + if not value: + return "" + value = re.sub(r"^camera:\s*", "", value, flags=re.IGNORECASE).strip() + if not value: + return "" + return f"Captured with {value}" + + def _camera_phrase(row: dict[str, Any]) -> str: directive = _clean(row.get("camera_directive")) if directive: - return directive + return _natural_camera_phrase(directive) config = row.get("camera_config") if isinstance(config, dict): detail = _clean(config.get("camera_detail")) @@ -341,13 +357,13 @@ def _camera_phrase(row: dict[str, Any]) -> str: if custom: base = _clean(config.get("camera_mode")).replace("_", " ") pieces = [piece for piece in (base, custom) if piece and piece != "standard"] - return "Camera: " + ", ".join(pieces) + return _natural_camera_phrase(", ".join(pieces)) 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: " + ", ".join(pieces) + return _natural_camera_phrase(", ".join(pieces)) return "" @@ -365,7 +381,7 @@ def _camera_phrase_from_config(config: Any) -> str: if custom: base = _clean(config.get("camera_mode")).replace("_", " ") pieces = [piece for piece in (base, custom) if piece and piece != "standard"] - return "Camera: " + ", ".join(pieces) + return _natural_camera_phrase(", ".join(pieces)) values = [ _clean(config.get("camera_mode")).replace("_", " "), _clean(config.get("shot_size")).replace("_", " "), @@ -378,13 +394,13 @@ def _camera_phrase_from_config(config: Any) -> str: pieces = [value for value in values if value and value not in ("auto", "standard")] if not pieces: return "" - return "Camera: " + ", ".join(pieces) + return _natural_camera_phrase(", ".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 + return _natural_camera_phrase(directive_text) if isinstance(config, dict) and ( _clean(config.get("camera_detail")) == "off" or _clean(config.get("camera_mode")) == "disabled" ): diff --git a/tools/prompt_route_simulation.py b/tools/prompt_route_simulation.py index 5adf21c..55a0baa 100644 --- a/tools/prompt_route_simulation.py +++ b/tools/prompt_route_simulation.py @@ -45,6 +45,7 @@ SOFTCORE_NOISE_TERMS = ( FORMATTER_LABEL_LEAKS = ( "body exposure:", + "camera:", "camera control:", "characters:", "clothing:", @@ -52,6 +53,7 @@ FORMATTER_LABEL_LEAKS = ( "composition:", "facial expression:", "facial expressions:", + "expressions:", "hardcore setup:", "outfit:", "pose:",