jayparmr's picture
Upload 118 files
19b3da3
raw
history blame
357 Bytes
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()