feature: adds text to video generation flag (#404)

Co-authored-by: jaydrennan
pull/406/head
jaydrennan 6 months ago committed by GitHub
parent 8fec56970e
commit cff17ef6f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,12 +29,14 @@ def imagine_image_files(
make_gif=False,
make_compare_gif=False,
return_filename_type="generated",
videogen=False,
):
from PIL import ImageDraw
from imaginairy.animations import make_bounce_animation
from imaginairy.img_utils import pillow_fit_image_within
from imaginairy.utils import get_next_filenumber
from imaginairy.video_sample import generate_video
generated_imgs_path = os.path.join(outdir, "generated")
os.makedirs(generated_imgs_path, exist_ok=True)
@ -86,6 +88,14 @@ def imagine_image_files(
logger.info(f" [{image_type}] saved to: {filepath}")
if image_type == return_filename_type:
result_filenames.append(filepath)
if videogen:
try:
generate_video(
input_path=filepath,
)
except FileNotFoundError as e:
logger.error(str(e))
exit(1)
if make_gif and result.progress_latents:
subpath = os.path.join(outdir, "gif")

@ -54,6 +54,13 @@ from imaginairy.cli.shared import _imagine_cmd, add_options, common_options
help="how the control image is used as signal",
multiple=True,
)
@click.option(
"--videogen",
is_flag=True,
default=False,
show_default=False,
help="Turns the generated photo into video",
)
@click.pass_context
def imagine_cmd(
ctx,
@ -99,6 +106,7 @@ def imagine_cmd(
control_image,
control_image_raw,
control_mode,
videogen,
):
"""
Generate images via AI.
@ -183,6 +191,7 @@ def imagine_cmd(
make_compilation_animation,
caption_text,
control_inputs=control_inputs,
videogen=videogen,
)

@ -66,6 +66,7 @@ def _imagine_cmd(
make_compilation_animation=False,
caption_text="",
control_inputs=None,
videogen=False,
):
"""Have the AI generate images. alias:imagine."""
@ -199,6 +200,7 @@ def _imagine_cmd(
precision=precision,
make_gif=make_gif,
make_compare_gif=make_compare_gif,
videogen=videogen,
)
if make_compilation_animation:
import os.path
@ -221,7 +223,6 @@ def _imagine_cmd(
imgs=comp_imgs,
image_pause_ms=1000,
)
logger.info(f"[compilation] saved to: {new_filename}")

Loading…
Cancel
Save