Spaces:
Running
Running
ideo(output.frames[0], path, fps=10) | |
return path | |
# Gradio Interface | |
with gr.Blocks(css="style.css") as demo: | |
gr.HTML( | |
"<h1><center>Textual Imagination : A Text To Video Synthesis</center></h1>" | |
) | |
with gr.Group(): | |
with gr.Row(): | |
prompt = gr.Textbox( | |
label='Prompt' | |
) | |
with gr.Row(): | |
select_base = gr.Dropdown( | |
label='Base model', | |
choices=[ | |
"Cartoon", | |
"Realistic", | |
"3d", | |
"Anime", | |
], | |
value=base_loaded, | |
interactive=True | |
) | |
select_motion = gr.Dropdown( | |
label='Motion', | |
choices=[ | |
("Default", ""), | |
("Zoom in", "guoyww/animatediff-motion-lora-zoom-in"), | |
("Zoom out", "guoyww/animatediff-motion-lora-zoom-out"), | |
("Tilt up", "guoyww/animatediff-motion-lora-tilt-up"), | |
("Tilt down", "guoyww/animatediff-motion-lora-tilt-down"), | |
("Pan left", "guoyww/animatediff-motion-lora-pan-left"), | |
("Pan right", "guoyww/animatediff-motion-lora-pan-right"), | |
("Roll left", "guoyww/animatediff-motion-lora-rolling-anticlockwise"), | |
("Roll right", "guoyww/animatediff-motion-lora-rolling-clockwise"), | |
], | |
value="guoyww/animatediff-motion-lora-zoom-in", | |
interactive=True | |
) | |
select_step = gr.Dropdown( | |
label='Inference steps', | |
choices=[ | |
('1-Step', 1), | |
('2-Step', 2), | |
('4-Step', 4), | |
('8-Step', 8), | |
], | |
value=4, | |
interactive=True | |
) | |
select_resolution = gr.Dropdown( | |
label='Resolution', | |
choices=[ | |
"Square", | |
"Horizontal", | |
], | |
value="Square", | |
interactive=True | |
) | |
submit = gr.Button( | |
scale=1, | |
variant='primary' | |
) | |
video = gr.Video( | |
label='AnimateDiff-Lightning', | |
autoplay=True, | |
height=512, | |
width=512, | |
elem_id="video_output" | |
) | |
gr.on( | |
triggers=[ | |
submit.click, | |
prompt.submit | |
], | |
fn=generate_image, | |
inputs=[prompt, select_base, select_motion, select_step, select_resolution], | |
outputs=[video], | |
api_name="instant_video", | |
queue=False | |
) | |
demo.queue().launch() | |