mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
update backend + revise styles
update backend + revise styles
This commit is contained in:
@@ -210,8 +210,8 @@ def worker():
|
||||
|
||||
if not skip_prompt_processing:
|
||||
|
||||
prompts = remove_empty_str([safe_str(p) for p in prompt.split('\n')], default='')
|
||||
negative_prompts = remove_empty_str([safe_str(p) for p in negative_prompt.split('\n')], default='')
|
||||
prompts = remove_empty_str([safe_str(p) for p in prompt.splitlines()], default='')
|
||||
negative_prompts = remove_empty_str([safe_str(p) for p in negative_prompt.splitlines()], default='')
|
||||
|
||||
prompt = prompts[0]
|
||||
negative_prompt = negative_prompts[0]
|
||||
@@ -239,8 +239,8 @@ def worker():
|
||||
if use_style:
|
||||
for s in style_selections:
|
||||
p, n = apply_style(s, positive=task_prompt)
|
||||
positive_basic_workloads.append(p)
|
||||
negative_basic_workloads.append(n)
|
||||
positive_basic_workloads += p
|
||||
negative_basic_workloads += n
|
||||
else:
|
||||
positive_basic_workloads.append(task_prompt)
|
||||
|
||||
|
||||
@@ -40,7 +40,9 @@ for styles_file in styles_files:
|
||||
try:
|
||||
with open(os.path.join(styles_path, styles_file), encoding='utf-8') as f:
|
||||
for entry in json.load(f):
|
||||
name, prompt, negative_prompt = normalize_key(entry['name']), entry['prompt'], entry['negative_prompt']
|
||||
name = normalize_key(entry['name'])
|
||||
prompt = entry['prompt'] if 'prompt' in entry else ''
|
||||
negative_prompt = entry['negative_prompt'] if 'negative_prompt' in entry else ''
|
||||
styles[name] = (prompt, negative_prompt)
|
||||
except Exception as e:
|
||||
print(str(e))
|
||||
@@ -53,7 +55,7 @@ legal_style_names = [fooocus_expansion] + style_keys
|
||||
|
||||
def apply_style(style, positive):
|
||||
p, n = styles[style]
|
||||
return p.replace('{prompt}', positive), n
|
||||
return p.replace('{prompt}', positive).splitlines(), n.splitlines()
|
||||
|
||||
|
||||
def apply_wildcards(wildcard_text, rng, directory=wildcards_path):
|
||||
|
||||
Reference in New Issue
Block a user