diff options
Diffstat (limited to 'modules/images.py')
-rw-r--r-- | modules/images.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/modules/images.py b/modules/images.py index 8f34dcc1..f1aed5d6 100644 --- a/modules/images.py +++ b/modules/images.py @@ -289,6 +289,16 @@ def apply_filename_pattern(x, p, seed, prompt): if prompt is not None:
x = x.replace("[prompt]", sanitize_filename_part(prompt))
+ if "[prompt_no_styles]" in x:
+ prompt_no_style = prompt
+ for style in shared.prompt_styles.get_style_prompts(p.styles):
+ 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))
if "[prompt_words]" in x:
words = [x for x in re_nonletters.split(prompt or "") if len(x) > 0]
@@ -301,7 +311,7 @@ def apply_filename_pattern(x, p, seed, prompt): x = x.replace("[cfg]", str(p.cfg_scale))
x = x.replace("[width]", str(p.width))
x = x.replace("[height]", str(p.height))
- x = x.replace("[styles]", sanitize_filename_part(", ".join(p.styles), replace_spaces=False))
+ x = x.replace("[styles]", sanitize_filename_part(", ".join([x for x in p.styles if not x == "None"]), replace_spaces=False))
x = x.replace("[sampler]", sanitize_filename_part(sd_samplers.samplers[p.sampler_index].name, replace_spaces=False))
x = x.replace("[model_hash]", shared.sd_model.sd_model_hash)
|