Simplify Future rebase

exit_image
Charles Fettinger 2023-05-08 03:01:35 -07:00
parent f313ac8a15
commit 7d6d5f6743
6 changed files with 50 additions and 73 deletions

View File

@ -117,9 +117,9 @@ def putPrompts(files):
print(
"[InfiniteZoom:] Loading your prompt failed. It seems to be invalid. Your prompt table is preserved."
)
asyncio.run(
showGradioErrorAsync("Loading your prompts failed. It seems to be invalid. Your prompt table has been preserved.",5)
)
# 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()]

View File

@ -2,7 +2,6 @@ from modules.processing import (
process_images,
StableDiffusionProcessingTxt2Img,
StableDiffusionProcessingImg2Img,
Processed
)
import modules.shared as shared

View File

@ -6,6 +6,7 @@ default_sampling_steps = 35
default_sampler = "DDIM"
default_cfg_scale = 8
default_mask_blur = 60
default_overmask = 8
default_total_outpaints = 5
promptTableHeaders = ["Outpaint Steps", "Prompt", "image location", "blend mask", "is keyframe"], ["number", "str", "str", "str", "bool"]
@ -21,7 +22,7 @@ default_prompt = """
[4, "a Verdant canopy","","",false]
]
},
"postPrompt": "style by Alex Horley Wenjun Lin greg rutkowski Ruan Jia (Wayne Barlowe:1.2), <lora:epiNoiseoffset_v2:0.6>",
"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"
}
"""

View File

@ -187,6 +187,7 @@ def on_ui_tabs():
value=30,
minimum=1,
maximum=60,
step=1
)
video_zoom_mode = gr.Radio(
label="Zoom mode",
@ -200,6 +201,7 @@ def on_ui_tabs():
value=0,
minimum=1,
maximum=60,
step=1
)
video_last_frame_dupe_amount = gr.Slider(
label="number of last frame dupe",
@ -207,6 +209,7 @@ def on_ui_tabs():
value=0,
minimum=1,
maximum=60,
step=1
)
video_zoom_speed = gr.Slider(
label="Zoom Speed",
@ -223,6 +226,7 @@ def on_ui_tabs():
minimum=0,
maximum=64,
value=default_mask_blur,
step=1
)
inpainting_fill_mode = gr.Radio(
label="Masked content",
@ -305,72 +309,8 @@ Our best experience and trade-off is the R-ERSGAn4x upscaler.
return [(infinite_zoom_interface, "Infinite Zoom", "iz_interface")]
def check_create_zoom(
main_common_prompt_pre,
main_prompts,
main_common_prompt_suf,
main_negative_prompt,
main_outpaint_steps,
main_guidance_scale,
sampling_step,
init_image,
exit_image,
video_frame_rate,
video_zoom_mode,
video_start_frame_dupe_amount,
video_last_frame_dupe_amount,
inpainting_denoising_strength,
inpainting_mask_blur,
inpainting_fill_mode,
inpainting_full_res,
inpainting_padding,
video_zoom_speed,
seed,
main_width,
main_height,
batchcount_slider,
main_sampler,
upscale_do,
upscaler_name,
upscale_by,
):
keys = main_prompts.keys()
if 0 not in keys:
raise gr.Error("Ensure your prompt table has a step 9 (zero) prompt")
return create_zoom(
main_common_prompt_pre,
main_prompts,
main_common_prompt_suf,
main_negative_prompt,
main_outpaint_steps,
main_guidance_scale,
sampling_step,
init_image,
exit_image,
video_frame_rate,
video_zoom_mode,
video_start_frame_dupe_amount,
video_last_frame_dupe_amount,
inpainting_denoising_strength,
inpainting_mask_blur,
inpainting_fill_mode,
inpainting_full_res,
inpainting_padding,
video_zoom_speed,
seed,
main_width,
main_height,
batchcount_slider,
main_sampler,
upscale_do,
upscaler_name,
upscale_by,
)
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

@ -55,9 +55,46 @@ def write_video(file_path, frames, fps, reversed=True, start_frame_dupe_amount=1
writer.append_data(np_frame)
# Write the duplicated frames to the video writer
for frame in end_frames:
for frame in end_frames:
np_frame = np.array(frame)
writer.append_data(np_frame)
# Close the video writer
writer.close()
writer.close()
class ContinuousVideoWriter:
_writer = None
def __init__(self, file_path, initframe, fps, start_frame_dupe_amount=15):
"""
Writes initial frame to a new mp4 video file
:param file_path: Path to output video, must end with .mp4
:param frame: Start image PIL.Image objects
:param fps: Desired frame rate
:param reversed: if order of images to be reversed (default = True)
"""
writer = imageio.get_writer(file_path, fps=fps, macro_block_size=None)
start_frames = [initframe] * start_frame_dupe_amount
for f in start_frames:
writer.append_data(np.array(f))
self._writer = writer
def append(self, frames):
"""
Append a list of image PIL.Image objects to the end of the file.
:param frames: List of image PIL.Image objects
"""
for i,f in enumerate(frames):
self._writer.append_data(np.array(f))
def finish(self, frame, last_frame_dupe_amount=30 ):
"""
Closes the file writer.
"""
for i in range(last_frame_dupe_amount):
self._writer.append_data(np.array(frame))
self._writer.close()

View File

@ -2,4 +2,4 @@ from modules import script_callbacks
from iz_helpers.ui import on_ui_tabs
from iz_helpers.settings import on_ui_settings
script_callbacks.on_ui_tabs(on_ui_tabs)
script_callbacks.on_ui_settings(on_ui_settings)
script_callbacks.on_ui_settings(on_ui_settings)