Merge branch 'develop' into frame-correction
Signed-off-by: vahid khroasani <62482657+v8hid@users.noreply.github.com>pull/76/head
commit
119f53a466
|
|
@ -100,9 +100,9 @@ def putPrompts(files):
|
||||||
|
|
||||||
data = readJsonPrompt(file_contents,False)
|
data = readJsonPrompt(file_contents,False)
|
||||||
return [
|
return [
|
||||||
gr.Textbox.update(data["commonPromptPrefix"]),
|
gr.Textbox.update(data["prePrompt"]),
|
||||||
gr.DataFrame.update(data["prompts"]),
|
gr.DataFrame.update(data["prompts"]),
|
||||||
gr.Textbox.update(data["commonPromptSuffix"]),
|
gr.Textbox.update(data["postPromt"]),
|
||||||
gr.Textbox.update(data["negPrompt"])
|
gr.Textbox.update(data["negPrompt"])
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,40 +7,21 @@ from .static_variables import (
|
||||||
jsonprompt_schemafile
|
jsonprompt_schemafile
|
||||||
)
|
)
|
||||||
|
|
||||||
"""
|
def completeOptionals(j):
|
||||||
json is valid, but not our current schema.
|
|
||||||
lets try something.
|
|
||||||
does it look like something usable?
|
|
||||||
def fixJson(j):
|
|
||||||
fixedJ = empty_prompt
|
|
||||||
try:
|
|
||||||
if isinstance(j, dict):
|
|
||||||
if "prompts" in j:
|
|
||||||
if "data" in j["prompts"]:
|
|
||||||
if isinstance (j["prompts"]["data"],list):
|
|
||||||
fixedJ["prompts"]["data"] = j["prompts"]["data"]
|
|
||||||
if not isinstance (fixedJ["prompts"]["data"][0].
|
|
||||||
|
|
||||||
if "headers" not in j["prompts"]:
|
|
||||||
fixedJ["prompts"]["headers"] = ["outpaint steps","prompt"]
|
|
||||||
else:
|
|
||||||
fixedJ["prompts"]["headers"] = j["prompts"]["headers"]
|
|
||||||
|
|
||||||
if "negPrompt" in j:
|
|
||||||
fixedJ["prompts"]["headers"]
|
|
||||||
|
|
||||||
if "commonPrompt" in j:
|
|
||||||
return j
|
|
||||||
except Exception:
|
|
||||||
raise "JsonFix: Failed on recovering json prompt"
|
|
||||||
return j
|
|
||||||
"""
|
|
||||||
|
|
||||||
def fixHeaders(j):
|
|
||||||
if isinstance(j, dict):
|
if isinstance(j, dict):
|
||||||
if "prompts" in j:
|
if "prompts" in j:
|
||||||
if "headers" not in j["prompts"]:
|
if "headers" not in j["prompts"]:
|
||||||
j["prompts"]["headers"] = ["outpaint steps","prompt"]
|
j["prompts"]["headers"] = ["outpaint steps","prompt"]
|
||||||
|
|
||||||
|
if "negPrompt" not in j:
|
||||||
|
j["negPrompt"]=""
|
||||||
|
|
||||||
|
if "prePrompt" not in j:
|
||||||
|
j["prePrompt"]=""
|
||||||
|
|
||||||
|
if "postPrompt" not in j:
|
||||||
|
j["postPrompt"]=""
|
||||||
|
|
||||||
return j
|
return j
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -49,11 +30,12 @@ def validatePromptJson_throws(data):
|
||||||
schema = json.load(s)
|
schema = json.load(s)
|
||||||
try:
|
try:
|
||||||
validate(instance=data, schema=schema)
|
validate(instance=data, schema=schema)
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
raise "Your prompts are not schema valid."
|
raise "Your prompts are not schema valid."
|
||||||
#fixJson(data)
|
#fixJson(data)
|
||||||
|
|
||||||
return fixHeaders(data)
|
return completeOptionals(data)
|
||||||
|
|
||||||
|
|
||||||
def readJsonPrompt(txt, returnFailPrompt=False):
|
def readJsonPrompt(txt, returnFailPrompt=False):
|
||||||
|
|
|
||||||
|
|
@ -47,17 +47,14 @@
|
||||||
"negPrompt": {
|
"negPrompt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"commonPromptPrefix": {
|
"prePrompt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
"commonPromptSuffix": {
|
"postPrompt": {
|
||||||
"type": "string"
|
"type": "string"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"required": [
|
"required": [
|
||||||
"prompts",
|
"prompts"
|
||||||
"negPrompt",
|
|
||||||
"commonPromptPrefix",
|
|
||||||
"commonPromptSuffix"
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -67,7 +67,7 @@ def on_ui_settings():
|
||||||
None,
|
None,
|
||||||
"Name of your desired model to render keyframes (txt2img)",
|
"Name of your desired model to render keyframes (txt2img)",
|
||||||
gr.Dropdown,
|
gr.Dropdown,
|
||||||
lambda: {"choices": shared.list_checkpoint_tiles()},
|
lambda: {"choices": [x for x in list(shared.list_checkpoint_tiles()) if "inpainting" not in x]},
|
||||||
section=section,
|
section=section,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
@ -78,7 +78,7 @@ def on_ui_settings():
|
||||||
None,
|
None,
|
||||||
"Name of your desired inpaint model (img2img-inpaint). Default is vanilla sd-v1-5-inpainting.ckpt ",
|
"Name of your desired inpaint model (img2img-inpaint). Default is vanilla sd-v1-5-inpainting.ckpt ",
|
||||||
gr.Dropdown,
|
gr.Dropdown,
|
||||||
lambda: {"choices": shared.list_checkpoint_tiles()},
|
lambda: {"choices": [x for x in list(shared.list_checkpoint_tiles()) if "inpainting" in x]},
|
||||||
section=section,
|
section=section,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ invalid_prompt = {
|
||||||
"headers": ["outpaint steps", "prompt"],
|
"headers": ["outpaint steps", "prompt"],
|
||||||
},
|
},
|
||||||
"negPrompt": "Invalid prompt-json",
|
"negPrompt": "Invalid prompt-json",
|
||||||
"commonPromptPrefix": "Invalid prompt",
|
"prePromp": "Invalid prompt",
|
||||||
"commonPromptSuffix": "Invalid prompt",
|
"postPrompt": "Invalid prompt"
|
||||||
}
|
}
|
||||||
|
|
||||||
available_samplers = [
|
available_samplers = [
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,7 @@ def on_ui_tabs():
|
||||||
jpr = readJsonPrompt(pr, True)
|
jpr = readJsonPrompt(pr, True)
|
||||||
|
|
||||||
main_common_prompt_pre = gr.Textbox(
|
main_common_prompt_pre = gr.Textbox(
|
||||||
value=jpr["commonPromptPrefix"], label="Common Prompt Prefix"
|
value=jpr["prePrompt"], label="Common Prompt Prefix"
|
||||||
)
|
)
|
||||||
|
|
||||||
main_prompts = gr.Dataframe(
|
main_prompts = gr.Dataframe(
|
||||||
|
|
@ -64,7 +64,7 @@ def on_ui_tabs():
|
||||||
)
|
)
|
||||||
|
|
||||||
main_common_prompt_suf = gr.Textbox(
|
main_common_prompt_suf = gr.Textbox(
|
||||||
value=jpr["commonPromptSuffix"], label="Common Prompt Suffix"
|
value=jpr["postPrompt"], label="Common Prompt Suffix"
|
||||||
)
|
)
|
||||||
|
|
||||||
main_negative_prompt = gr.Textbox(
|
main_negative_prompt = gr.Textbox(
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
from modules import script_callbacks
|
from modules import script_callbacks
|
||||||
from iz_helpers.ui import on_ui_tabs
|
from iz_helpers.ui import on_ui_tabs
|
||||||
from iz_helpers.settings import on_ui_settings
|
from iz_helpers.settings import on_ui_settings
|
||||||
|
|
||||||
|
|
||||||
script_callbacks.on_ui_tabs(on_ui_tabs)
|
script_callbacks.on_ui_tabs(on_ui_tabs)
|
||||||
script_callbacks.on_ui_settings(on_ui_settings)
|
script_callbacks.on_ui_settings(on_ui_settings)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue