Merge pull request #75 from v8hid/validate_table_on_generate

Validate table on generate
pull/78/head
vahid khroasani 2023-05-01 19:11:56 +04:00 committed by GitHub
commit 6380e1ab0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 11 deletions

View File

@ -9,9 +9,10 @@ from .static_variables import (
def completeOptionals(j):
if isinstance(j, dict):
# Remove header information, user dont pimp our ui
if "prompts" in j:
if "headers" not in j["prompts"]:
j["prompts"]["headers"] = ["outpaint steps","prompt"]
if "headers" in j["prompts"]:
del j["prompts"]["headers"]
if "negPrompt" not in j:
j["negPrompt"]=""
@ -32,8 +33,7 @@ def validatePromptJson_throws(data):
validate(instance=data, schema=schema)
except Exception:
raise "Your prompts are not schema valid."
#fixJson(data)
raise Exception("Your prompts are not schema valid.")
return completeOptionals(data)

View File

@ -42,7 +42,7 @@ def on_ui_tabs():
maximum=100,
step=1,
value=8,
label="Total Outpaint Steps",
label="Total video length [s]",
)
# safe reading json prompt
@ -55,7 +55,7 @@ def on_ui_tabs():
main_prompts = gr.Dataframe(
type="array",
headers=["outpaint step", "prompt"],
headers=["Start at second [0,1,...]", "Prompt"],
datatype=["number", "str"],
row_count=1,
col_count=(2, "fixed"),
@ -255,6 +255,7 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
) = create_output_panel(
"infinite-zoom", shared.opts.outdir_img2img_samples
)
generate_btn.click(
fn=wrap_gradio_gpu_call(create_zoom, extra_outputs=[None, "", ""]),
inputs=[
@ -288,6 +289,17 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
],
outputs=[output_video, out_image, generation_info, html_info, html_log],
)
interrupt.click(fn=lambda: shared.state.interrupt(), inputs=[], outputs=[])
main_prompts.change(fn=checkPrompts,inputs=[main_prompts], outputs=[generate_btn])
interrupt.click(fn=shared.state.interrupt(), inputs=[], outputs=[])
infinite_zoom_interface.queue()
return [(infinite_zoom_interface, "Infinite Zoom", "iz_interface")]
def checkPrompts(p):
return gr.Button.update(
interactive=
any(0 in sublist for sublist in p)
or
any('0' in sublist for sublist in p)
)

View File

@ -2,7 +2,7 @@
infzoom_titles = {
"Batch Count":"How many separate videos to create",
"Total Outpaint Steps":"The more it is, the longer your videos will be. Each step generates frame for 1 second at your FPS, while cycling through your array of prompts",
"Total video length [s]":"For each seconds frame (FPS) will be generated. Define prompts at which time they should start wihtin this duration.",
"Common Prompt Prefix":"Prompt inserted before each step",
"Common Prompt Suffix":"Prompt inserted after each step",
"Negative Prompt":"What your model shall avoid",
@ -12,9 +12,8 @@ infzoom_titles = {
"Custom initial image":"An image at the end resp. begin of your movie, depending or ZoomIn or Out",
"Custom exit image":"An image at the end resp. begin of your movie, depending or ZoomIn or Out",
"Zoom Speed":"Varies additional frames per second",
"Start at second [0,1,...]": "At which time the prompt has to be occure. We need at least one prompt starting at time 0",
"Generate video": "Start rendering. If it´s disabled the prompt table is invalid, check we have a start prompt at time 0"
}