diff options
author | RnDMonkey <ryandrutledge@gmail.com> | 2022-09-30 07:37:18 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2022-09-30 10:00:43 +0000 |
commit | 5c0c778a65c8f89a85395fb10e32d3b35ea57196 (patch) | |
tree | 22349e241cb5ac265fce82bd466671d357f9ae6e /modules/images.py | |
parent | ff4df06c573c7054f736e0b5a35c24fad2427ab0 (diff) | |
download | stable-diffusion-webui-gfx803-5c0c778a65c8f89a85395fb10e32d3b35ea57196.tar.gz stable-diffusion-webui-gfx803-5c0c778a65c8f89a85395fb10e32d3b35ea57196.tar.bz2 stable-diffusion-webui-gfx803-5c0c778a65c8f89a85395fb10e32d3b35ea57196.zip |
fixed so that {prompt} can be anywhere in style
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/images.py b/modules/images.py index 87a4caf6..169e19e6 100644 --- a/modules/images.py +++ b/modules/images.py @@ -290,7 +290,11 @@ def apply_filename_pattern(x, p, seed, prompt): if "[prompt_no_styles]" in x:
prompt_no_style = prompt
for style in shared.prompt_styles.get_style_prompts(p.styles):
- prompt_no_style = prompt_no_style.replace(style.replace("{prompt}", ""), "")
+ if len(style) > 0:
+ style_parts = [y for y in style.split("{prompt}")]
+ for part in style_parts:
+ prompt_no_style = prompt_no_style.replace(part, "").replace(", ,", ",").strip().strip(',')
+ prompt_no_style = prompt_no_style.replace(style, "").strip().strip(',').strip()
x = x.replace("[prompt_no_styles]", sanitize_filename_part(prompt_no_style, replace_spaces=False))
x = x.replace("[prompt_spaces]", sanitize_filename_part(prompt, replace_spaces=False))
|