added common prompt; todo convert old json prompts to 1.1 schema
parent
365bb7e82a
commit
b0cb75399e
|
|
@ -122,4 +122,5 @@ def clearPrompts():
|
||||||
return [
|
return [
|
||||||
gr.DataFrame.update(value=[[0, "Infinite Zoom. Start over"]]),
|
gr.DataFrame.update(value=[[0, "Infinite Zoom. Start over"]]),
|
||||||
gr.Textbox.update(""),
|
gr.Textbox.update(""),
|
||||||
|
gr.Textbox.update("")
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,49 +1,60 @@
|
||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
"type": "object",
|
"$id": "1.1",
|
||||||
"properties": {
|
"type": "object",
|
||||||
"prompts": {
|
"properties": {
|
||||||
"type": "object",
|
"prompts": {
|
||||||
"properties": {
|
"type": "object",
|
||||||
"data": {
|
"properties": {
|
||||||
|
"data": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"items": {
|
"items": [
|
||||||
"type": "array",
|
{
|
||||||
"items": [
|
"oneOf": [
|
||||||
{
|
{
|
||||||
"oneOf": [
|
"type": "integer",
|
||||||
{
|
"minimum": 0
|
||||||
"type": "integer",
|
},
|
||||||
"minimum": 0
|
{
|
||||||
},
|
"type": "string"
|
||||||
{
|
}
|
||||||
"type": "string"
|
]
|
||||||
}
|
},
|
||||||
]
|
{
|
||||||
},
|
"type": "string"
|
||||||
{
|
}
|
||||||
"type": "string"
|
],
|
||||||
}
|
"minItems": 0,
|
||||||
],
|
"maxItems": 999,
|
||||||
"minItems": 0,
|
"uniqueItems": false
|
||||||
"maxItems": 999,
|
|
||||||
"uniqueItems": false
|
|
||||||
},
|
|
||||||
"minItems": 0
|
|
||||||
},
|
},
|
||||||
"headers": {
|
"minItems": 0
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"minItems": 2
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"required": ["data", "headers"]
|
"headers": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"minItems": 3
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"negPrompt": {
|
"required": [
|
||||||
"type": "string"
|
"data",
|
||||||
}
|
"headers"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"required": ["prompts", "negPrompt"]
|
"negPrompt": {
|
||||||
}
|
"type": "string"
|
||||||
|
},
|
||||||
|
"commonPrompt": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"prompts",
|
||||||
|
"negPrompt",
|
||||||
|
"commonPrompt"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -16,6 +16,7 @@ from .video import write_video
|
||||||
|
|
||||||
|
|
||||||
def create_zoom(
|
def create_zoom(
|
||||||
|
common_prompt,
|
||||||
prompts_array,
|
prompts_array,
|
||||||
negative_prompt,
|
negative_prompt,
|
||||||
num_outpainting_steps,
|
num_outpainting_steps,
|
||||||
|
|
@ -46,6 +47,7 @@ def create_zoom(
|
||||||
for i in range(batchcount):
|
for i in range(batchcount):
|
||||||
print(f"Batch {i+1}/{batchcount}")
|
print(f"Batch {i+1}/{batchcount}")
|
||||||
result = create_zoom_single(
|
result = create_zoom_single(
|
||||||
|
common_prompt,
|
||||||
prompts_array,
|
prompts_array,
|
||||||
negative_prompt,
|
negative_prompt,
|
||||||
num_outpainting_steps,
|
num_outpainting_steps,
|
||||||
|
|
@ -76,6 +78,7 @@ def create_zoom(
|
||||||
|
|
||||||
|
|
||||||
def create_zoom_single(
|
def create_zoom_single(
|
||||||
|
common_prompt,
|
||||||
prompts_array,
|
prompts_array,
|
||||||
negative_prompt,
|
negative_prompt,
|
||||||
num_outpainting_steps,
|
num_outpainting_steps,
|
||||||
|
|
@ -139,8 +142,9 @@ def create_zoom_single(
|
||||||
"infzoom_txt2img_model", progress, "Loading Model for txt2img: "
|
"infzoom_txt2img_model", progress, "Loading Model for txt2img: "
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pr = prompts[min(k for k in prompts.keys() if k >= 0)]
|
||||||
processed, newseed = renderTxt2Img(
|
processed, newseed = renderTxt2Img(
|
||||||
prompts[min(k for k in prompts.keys() if k >= 0)],
|
f"{common_prompt}\n{pr}" if common_prompt else pr,
|
||||||
negative_prompt,
|
negative_prompt,
|
||||||
sampler,
|
sampler,
|
||||||
num_inference_steps,
|
num_inference_steps,
|
||||||
|
|
@ -203,8 +207,9 @@ def create_zoom_single(
|
||||||
)
|
)
|
||||||
print("using Custom Exit Image")
|
print("using Custom Exit Image")
|
||||||
else:
|
else:
|
||||||
|
pr = prompts[max(k for k in prompts.keys() if k <= i)]
|
||||||
processed, newseed = renderImg2Img(
|
processed, newseed = renderImg2Img(
|
||||||
prompts[max(k for k in prompts.keys() if k <= i)],
|
f"{common_prompt}\n{pr}" if common_prompt else pr,
|
||||||
negative_prompt,
|
negative_prompt,
|
||||||
sampler,
|
sampler,
|
||||||
num_inference_steps,
|
num_inference_steps,
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,18 @@ import modules.sd_samplers
|
||||||
default_prompt = """
|
default_prompt = """
|
||||||
{
|
{
|
||||||
"prompts":{
|
"prompts":{
|
||||||
"headers":["outpaint steps","prompt"],
|
"headers":["outpaint steps","prompt","img"],
|
||||||
"data":[
|
"data":[
|
||||||
[0,"Huge spectacular Waterfall in a dense tropical forest,epic perspective,(vegetation overgrowth:1.3)(intricate, ornamentation:1.1),(baroque:1.1), fantasy, (realistic:1) digital painting , (magical,mystical:1.2) , (wide angle shot:1.4), (landscape composed:1.2)(medieval:1.1), divine,cinematic,(tropical forest:1.4),(river:1.3)mythology,india, volumetric lighting, Hindu ,epic, Alex Horley Wenjun Lin greg rutkowski Ruan Jia (Wayne Barlowe:1.2) <lora:epiNoiseoffset_v2:0.6> "]
|
[0,"Huge spectacular Waterfall in a dense tropical forest,epic perspective,(vegetation overgrowth:1.3)(intricate, ornamentation:1.1),(baroque:1.1), fantasy, (realistic:1) digital painting , (magical,mystical:1.2) , (wide angle shot:1.4), (landscape composed:1.2)(medieval:1.1), divine,cinematic,(tropical forest:1.4),(river:1.3)mythology,india, volumetric lighting, Hindu ,epic"]
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"negPrompt":"frames, borderline, text, character, duplicate, error, out of frame, watermark, low quality, ugly, deformed, blur bad-artist"
|
"negPrompt":"frames, border, edges, borderline, text, character, duplicate, error, out of frame, watermark, low quality, ugly, deformed, blur bad-artist",
|
||||||
|
"commonPrompt":"style by Alex Horley Wenjun Lin greg rutkowski Ruan Jia (Wayne Barlowe:1.2), <lora:epiNoiseoffset_v2:0.6> "
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
available_samplers = [
|
|
||||||
s.name for s in modules.sd_samplers.samplers if "UniPc" not in s.name
|
|
||||||
]
|
|
||||||
|
|
||||||
empty_prompt = (
|
empty_prompt = (
|
||||||
'{"prompts":{"data":[],"headers":["outpaint steps","prompt"]},"negPrompt":""}'
|
'{"prompts":{"data":[],"headers":["outpaint steps","prompt"]},"negPrompt":"", commonPrompt:""}'
|
||||||
)
|
)
|
||||||
|
|
||||||
invalid_prompt = {
|
invalid_prompt = {
|
||||||
|
|
@ -27,7 +25,13 @@ invalid_prompt = {
|
||||||
"headers": ["outpaint steps", "prompt"],
|
"headers": ["outpaint steps", "prompt"],
|
||||||
},
|
},
|
||||||
"negPrompt": "Invalid prompt-json",
|
"negPrompt": "Invalid prompt-json",
|
||||||
|
"commonPrompt": "Invalid prompt"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
available_samplers = [
|
||||||
|
s.name for s in modules.sd_samplers.samplers if "UniPc" not in s.name
|
||||||
|
]
|
||||||
|
|
||||||
current_script_dir = scripts.basedir().split(os.sep)[
|
current_script_dir = scripts.basedir().split(os.sep)[
|
||||||
-2:
|
-2:
|
||||||
] # contains install and our extension foldername
|
] # contains install and our extension foldername
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,10 @@ def on_ui_tabs():
|
||||||
except Exception:
|
except Exception:
|
||||||
jpr = invalid_prompt
|
jpr = invalid_prompt
|
||||||
|
|
||||||
|
main_common_prompt = gr.Textbox(
|
||||||
|
value=jpr["commonPrompt"], label="Common Prompt"
|
||||||
|
)
|
||||||
|
|
||||||
main_prompts = gr.Dataframe(
|
main_prompts = gr.Dataframe(
|
||||||
type="array",
|
type="array",
|
||||||
headers=["outpaint step", "prompt"],
|
headers=["outpaint step", "prompt"],
|
||||||
|
|
@ -79,7 +83,7 @@ def on_ui_tabs():
|
||||||
exportPrompts_button.click(
|
exportPrompts_button.click(
|
||||||
None,
|
None,
|
||||||
_js="exportPrompts",
|
_js="exportPrompts",
|
||||||
inputs=[main_prompts, main_negative_prompt],
|
inputs=[main_common_prompt, main_prompts, main_negative_prompt],
|
||||||
outputs=None,
|
outputs=None,
|
||||||
)
|
)
|
||||||
importPrompts_button.upload(
|
importPrompts_button.upload(
|
||||||
|
|
@ -97,7 +101,7 @@ def on_ui_tabs():
|
||||||
clearPrompts_button.click(
|
clearPrompts_button.click(
|
||||||
fn=clearPrompts,
|
fn=clearPrompts,
|
||||||
inputs=[],
|
inputs=[],
|
||||||
outputs=[main_prompts, main_negative_prompt],
|
outputs=[main_prompts, main_negative_prompt, main_common_prompt],
|
||||||
)
|
)
|
||||||
with gr.Row():
|
with gr.Row():
|
||||||
seed = gr.Number(
|
seed = gr.Number(
|
||||||
|
|
@ -237,6 +241,7 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
|
||||||
generate_btn.click(
|
generate_btn.click(
|
||||||
fn=wrap_gradio_gpu_call(create_zoom, extra_outputs=[None, "", ""]),
|
fn=wrap_gradio_gpu_call(create_zoom, extra_outputs=[None, "", ""]),
|
||||||
inputs=[
|
inputs=[
|
||||||
|
main_common_prompt,
|
||||||
main_prompts,
|
main_prompts,
|
||||||
main_negative_prompt,
|
main_negative_prompt,
|
||||||
main_outpaint_steps,
|
main_outpaint_steps,
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
// Function to download data to a file
|
// Function to download data to a file
|
||||||
function exportPrompts(p, np, filename = "infinite-zoom-prompts.json") {
|
function exportPrompts(cp,p, np, filename = "infinite-zoom-prompts.json") {
|
||||||
|
|
||||||
let J = { prompts: p, negPrompt: np }
|
let J = { prompts: p, negPrompt: np, commonPrompt: cp }
|
||||||
|
|
||||||
var file = new Blob([JSON.stringify(J)], { type: "text/csv" });
|
var file = new Blob([JSON.stringify(J)], { type: "text/csv" });
|
||||||
if (window.navigator.msSaveOrOpenBlob) // IE10+
|
if (window.navigator.msSaveOrOpenBlob) // IE10+
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue