import re | |
from typing import Dict | |
def apply_style_args(data: Dict): | |
prompt = data.get("prompt", None) | |
if prompt is None: | |
return | |
result = re.match(r"\[style:(.*?)\]", prompt) | |
if result is not None: | |
style = result.group(1) | |
data["style"] = style | |
data["prompt"] = prompt.replace(f"[style:{style}]", "").strip() | |