feat: add A1111 prompt style detection

only detects one style as Fooocus doesn't wrap {prompt} with the whole style, but has a separate prompt string for each style
This commit is contained in:
Manuel Schmid
2024-01-28 23:52:06 +01:00
parent 236278948b
commit 5e84a45e22
2 changed files with 104 additions and 12 deletions
+5 -12
View File
@@ -6,7 +6,7 @@ from PIL import Image
import modules.config
import fooocus_version
# import advanced_parameters
from modules.util import quote, unquote, is_json
from modules.util import quote, unquote, extract_styles_from_prompt, is_json
from modules.flags import MetadataScheme, Performance, Steps
re_param_code = r'\s*(\w[\w \-/]+):\s*("(?:\\.|[^\\"])+"|[^,]*)(?:,|$)'
@@ -65,17 +65,10 @@ class A1111MetadataParser(MetadataParser):
prompt += ('' if prompt == '' else "\n") + line
# set defaults
data = {
'styles': '[]'
}
# if shared.opts.infotext_styles != "Ignore":
# found_styles, prompt, negative_prompt = shared.prompt_styles.extract_styles_from_prompt(prompt,
# negative_prompt)
#
# if shared.opts.infotext_styles == "Apply":
# res["Styles array"] = found_styles
# elif shared.opts.infotext_styles == "Apply if any" and found_styles:
# res["Styles array"] = found_styles
data = {}
found_styles, prompt, negative_prompt = extract_styles_from_prompt(prompt, negative_prompt)
data['styles'] = str(found_styles)
data |= {
'prompt': prompt,