Update Json to save audio file location
parent
a45e6efa67
commit
b4ded06b66
|
|
@ -112,6 +112,8 @@ def putPrompts(files):
|
|||
gr.Textbox.update(data["postPrompt"]),
|
||||
gr.Textbox.update(data["negPrompt"]),
|
||||
gr.Slider.update(value=prompts_keys[0]),
|
||||
gr.Textbox.update(data["audioFileName"]),
|
||||
gr.Number.update(data["seed"])
|
||||
]
|
||||
|
||||
except Exception:
|
||||
|
|
@ -121,7 +123,7 @@ def putPrompts(files):
|
|||
# error only be shown with raise, so ui gets broken.
|
||||
#asyncio.run(showGradioErrorAsync("Loading your prompts failed. It seems to be invalid. Your prompt table has been preserved.",5))
|
||||
|
||||
return [gr.Textbox.update(), gr.DataFrame.update(), gr.Textbox.update(),gr.Textbox.update()]
|
||||
return [gr.Textbox.update(), gr.DataFrame.update(), gr.Textbox.update(),gr.Textbox.update(),gr.Textbox.update(),gr.Number.update()]
|
||||
|
||||
|
||||
def clearPrompts():
|
||||
|
|
@ -129,7 +131,9 @@ def clearPrompts():
|
|||
gr.DataFrame.update(value=[[0, "Infinite Zoom. Start over"]]),
|
||||
gr.Textbox.update(""),
|
||||
gr.Textbox.update(""),
|
||||
gr.Textbox.update("")
|
||||
gr.Textbox.update(""),
|
||||
gr.Textbox.update(None),
|
||||
gr.Number.update(-1),
|
||||
]
|
||||
|
||||
def value_to_bool(value):
|
||||
|
|
|
|||
|
|
@ -40,6 +40,11 @@ def completeOptionals(j):
|
|||
else:
|
||||
j["postPrompt"]=""
|
||||
|
||||
if "audioFileName" not in j:
|
||||
j["audioFileName"]= None
|
||||
|
||||
if "seed" not in j:
|
||||
j["seed"]= -1
|
||||
return j
|
||||
|
||||
def validatePromptJson_throws(data):
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "1.2",
|
||||
"$id": "1.3",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"prompts": {
|
||||
|
|
@ -66,6 +66,12 @@
|
|||
},
|
||||
"postPrompt": {
|
||||
"type": "string"
|
||||
},
|
||||
"audioFileName": {
|
||||
"type": "string"
|
||||
},
|
||||
"seed": {
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
|
|
|
|||
|
|
@ -24,12 +24,14 @@ default_prompt = """
|
|||
]
|
||||
},
|
||||
"postPrompt": "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),(tropical forest:1.4),(river:1.3) volumetric lighting ,epic, style by Alex Horley Wenjun Lin greg rutkowski Ruan Jia (Wayne Barlowe:1.2)",
|
||||
"negPrompt": "frames, border, edges, 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",
|
||||
"audioFileName": None,
|
||||
"seed":-1
|
||||
}
|
||||
"""
|
||||
|
||||
empty_prompt = (
|
||||
'{"prompts":{"data":[0,"","","",false],"headers":["Outpaintg Steps","prompt","image location", "blend mask location", "is keyframe"]},"negPrompt":"", prePrompt:"", postPrompt:""}'
|
||||
'{"prompts":{"data":[0,"","","",false],"headers":["Outpaintg Steps","prompt","image location", "blend mask location", "is keyframe"]},"negPrompt":"", "prePrompt":"", "postPrompt":"", "audioFileName":None, "seed":-1}'
|
||||
)
|
||||
|
||||
invalid_prompt = {
|
||||
|
|
@ -40,6 +42,8 @@ invalid_prompt = {
|
|||
"negPrompt": "Invalid prompt-json",
|
||||
"prePrompt": "Invalid prompt",
|
||||
"postPrompt": "Invalid prompt",
|
||||
"audioFileName": None,
|
||||
"seed":-1
|
||||
}
|
||||
|
||||
available_samplers = [
|
||||
|
|
|
|||
131
iz_helpers/ui.py
131
iz_helpers/ui.py
|
|
@ -24,6 +24,9 @@ from .static_variables import promptTableHeaders
|
|||
|
||||
|
||||
def on_ui_tabs():
|
||||
main_seed = gr.Number()
|
||||
audio_filename = gr.Textbox(None)
|
||||
|
||||
with gr.Blocks(analytics_enabled=False) as infinite_zoom_interface:
|
||||
gr.HTML(
|
||||
"""
|
||||
|
|
@ -85,63 +88,14 @@ def on_ui_tabs():
|
|||
value=jpr["negPrompt"], label="Negative Prompt"
|
||||
)
|
||||
|
||||
# these button will be moved using JS under the dataframe view as small ones
|
||||
exportPrompts_button = gr.Button(
|
||||
value="Export prompts",
|
||||
variant="secondary",
|
||||
elem_classes="sm infzoom_tab_butt",
|
||||
elem_id="infzoom_exP_butt",
|
||||
)
|
||||
importPrompts_button = gr.UploadButton(
|
||||
label="Import prompts",
|
||||
variant="secondary",
|
||||
elem_classes="sm infzoom_tab_butt",
|
||||
elem_id="infzoom_imP_butt",
|
||||
)
|
||||
exportPrompts_button.click(
|
||||
None,
|
||||
_js="exportPrompts",
|
||||
inputs=[
|
||||
main_common_prompt_pre,
|
||||
main_prompts,
|
||||
main_common_prompt_suf,
|
||||
main_negative_prompt,
|
||||
],
|
||||
outputs=None,
|
||||
)
|
||||
importPrompts_button.upload(
|
||||
fn=putPrompts,
|
||||
outputs=[
|
||||
main_common_prompt_pre,
|
||||
main_prompts,
|
||||
main_common_prompt_suf,
|
||||
main_negative_prompt,
|
||||
main_outpaint_steps,
|
||||
],
|
||||
inputs=[importPrompts_button],
|
||||
)
|
||||
|
||||
clearPrompts_button = gr.Button(
|
||||
value="Clear prompts",
|
||||
variant="secondary",
|
||||
elem_classes="sm infzoom_tab_butt",
|
||||
elem_id="infzoom_clP_butt",
|
||||
)
|
||||
clearPrompts_button.click(
|
||||
fn=clearPrompts,
|
||||
inputs=[],
|
||||
outputs=[
|
||||
main_prompts,
|
||||
main_negative_prompt,
|
||||
main_common_prompt_pre,
|
||||
main_common_prompt_suf,
|
||||
],
|
||||
)
|
||||
|
||||
with gr.Accordion("Render settings"):
|
||||
with gr.Row():
|
||||
seed = gr.Number(
|
||||
label="Seed", value=-1, precision=0, interactive=True
|
||||
main_seed = gr.Number(
|
||||
label="Seed",
|
||||
value=jpr["seed"],
|
||||
elem_id="infzoom_main_seed",
|
||||
precision=0,
|
||||
interactive=True
|
||||
)
|
||||
main_sampler = gr.Dropdown(
|
||||
label="Sampler",
|
||||
|
|
@ -256,7 +210,10 @@ Ideas for custom blend images: https://www.pexels.com/search/gradient/
|
|||
|
||||
with gr.Tab("Audio"):
|
||||
with gr.Row():
|
||||
audio_filename = gr.Textbox(value=None, label="Audio File Name")
|
||||
audio_filename = gr.Textbox(
|
||||
value=jpr["audioFileName"],
|
||||
label="Audio File Name",
|
||||
elem_id="infzoom_audioFileName")
|
||||
audio_file = gr.File(
|
||||
value=None,
|
||||
file_count="single",
|
||||
|
|
@ -303,6 +260,66 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
|
|||
"""
|
||||
)
|
||||
|
||||
|
||||
# these buttons will be moved using JS under the dataframe view as small ones
|
||||
exportPrompts_button = gr.Button(
|
||||
value="Export prompts",
|
||||
variant="secondary",
|
||||
elem_classes="sm infzoom_tab_butt",
|
||||
elem_id="infzoom_exP_butt",
|
||||
)
|
||||
importPrompts_button = gr.UploadButton(
|
||||
label="Import prompts",
|
||||
variant="secondary",
|
||||
elem_classes="sm infzoom_tab_butt",
|
||||
elem_id="infzoom_imP_butt",
|
||||
)
|
||||
exportPrompts_button.click(
|
||||
None,
|
||||
_js="exportPrompts",
|
||||
inputs=[
|
||||
main_common_prompt_pre,
|
||||
main_prompts,
|
||||
main_common_prompt_suf,
|
||||
main_negative_prompt,
|
||||
audio_filename,
|
||||
main_seed
|
||||
],
|
||||
outputs=None,
|
||||
)
|
||||
importPrompts_button.upload(
|
||||
fn=putPrompts,
|
||||
outputs=[
|
||||
main_common_prompt_pre,
|
||||
main_prompts,
|
||||
main_common_prompt_suf,
|
||||
main_negative_prompt,
|
||||
main_outpaint_steps,
|
||||
audio_filename,
|
||||
main_seed
|
||||
],
|
||||
inputs=[importPrompts_button],
|
||||
)
|
||||
|
||||
clearPrompts_button = gr.Button(
|
||||
value="Clear prompts",
|
||||
variant="secondary",
|
||||
elem_classes="sm infzoom_tab_butt",
|
||||
elem_id="infzoom_clP_butt",
|
||||
)
|
||||
clearPrompts_button.click(
|
||||
fn=clearPrompts,
|
||||
inputs=[],
|
||||
outputs=[
|
||||
main_prompts,
|
||||
main_negative_prompt,
|
||||
main_common_prompt_pre,
|
||||
main_common_prompt_suf,
|
||||
audio_filename,
|
||||
main_seed
|
||||
],
|
||||
)
|
||||
|
||||
with gr.Column(scale=1, variant="compact"):
|
||||
output_video = gr.Video(label="Output").style(width=512, height=512)
|
||||
(
|
||||
|
|
@ -333,7 +350,7 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
|
|||
inpainting_mask_blur,
|
||||
inpainting_fill_mode,
|
||||
video_zoom_speed,
|
||||
seed,
|
||||
main_seed,
|
||||
main_width,
|
||||
main_height,
|
||||
batchcount_slider,
|
||||
|
|
|
|||
|
|
@ -13,7 +13,8 @@ infzoom_titles = {
|
|||
"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"
|
||||
"Generate video": "Start rendering. If it´s disabled the prompt table is invalid, check we have a start prompt at time 0",
|
||||
"Audio File Name": "File used to mix audio over the video. The shorter of the two (audio, video) length is used"
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
// Function to download data to a file
|
||||
function exportPrompts(cppre, p, cpsuf, np, filename = "infinite-zoom-prompts.json") {
|
||||
function exportPrompts(cppre, p, cpsuf, np, afn, s, filename = "infinite-zoom-prompts.json") {
|
||||
|
||||
let J = { prompts: p, negPrompt: np, prePrompt: cppre, postPrompt: cpsuf }
|
||||
let J = { prompts: p, negPrompt: np, prePrompt: cppre, postPrompt: cpsuf, audioFileName: afn, seed: s }
|
||||
|
||||
var file = new Blob([JSON.stringify(J,null,2)], { type: "text/csv" });
|
||||
if (window.navigator.msSaveOrOpenBlob) // IE10+
|
||||
|
|
|
|||
Loading…
Reference in New Issue