mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
fix: add positive prompt if styles don't have a prompt placeholder (#3372)
fixes https://github.com/lllyasviel/Fooocus/issues/3367
This commit is contained in:
@@ -689,13 +689,20 @@ def worker():
|
|||||||
|
|
||||||
task_styles = async_task.style_selections.copy()
|
task_styles = async_task.style_selections.copy()
|
||||||
if use_style:
|
if use_style:
|
||||||
|
placeholder_replaced = False
|
||||||
|
|
||||||
for j, s in enumerate(task_styles):
|
for j, s in enumerate(task_styles):
|
||||||
if s == random_style_name:
|
if s == random_style_name:
|
||||||
s = get_random_style(task_rng)
|
s = get_random_style(task_rng)
|
||||||
task_styles[j] = s
|
task_styles[j] = s
|
||||||
p, n = apply_style(s, positive=task_prompt)
|
p, n, style_has_placeholder = apply_style(s, positive=task_prompt)
|
||||||
|
if style_has_placeholder:
|
||||||
|
placeholder_replaced = True
|
||||||
positive_basic_workloads = positive_basic_workloads + p
|
positive_basic_workloads = positive_basic_workloads + p
|
||||||
negative_basic_workloads = negative_basic_workloads + n
|
negative_basic_workloads = negative_basic_workloads + n
|
||||||
|
|
||||||
|
if not placeholder_replaced:
|
||||||
|
positive_basic_workloads = [task_prompt] + positive_basic_workloads
|
||||||
else:
|
else:
|
||||||
positive_basic_workloads.append(task_prompt)
|
positive_basic_workloads.append(task_prompt)
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ def get_random_style(rng: Random) -> str:
|
|||||||
|
|
||||||
def apply_style(style, positive):
|
def apply_style(style, positive):
|
||||||
p, n = styles[style]
|
p, n = styles[style]
|
||||||
return p.replace('{prompt}', positive).splitlines(), n.splitlines()
|
return p.replace('{prompt}', positive).splitlines(), n.splitlines(), '{prompt}' in p
|
||||||
|
|
||||||
|
|
||||||
def get_words(arrays, total_mult, index):
|
def get_words(arrays, total_mult, index):
|
||||||
|
|||||||
Reference in New Issue
Block a user