Spaces:
Sleeping
Sleeping
import animation | |
import bgm | |
import narrator | |
import story | |
import subtitles | |
import gradio as gr | |
def generate_video(text, auth_openai, auth_elevenlabs, auth_replicate, auth_rev): | |
generated_story = story.text2story(text, auth_openai) | |
narrator.text2voice(generated_story, "audio_out.mp3", auth_elevenlabs, 5) | |
deforum_str, max_frames = subtitles.audio2subtitle(auth_rev) | |
generated_animation = animation.story2video(deforum_str, max_frames, auth_replicate) | |
# generated_music = bgm.text2audio(text=text, duration=20, guidance_scale=5, random_seed=24, n_candidates=3) | |
return generated_animation | |
def download_video(v): | |
pass | |
with gr.Blocks() as demo: | |
gr.Markdown("Generate a narrated horror story video from a text prompt.") | |
with gr.Row(): | |
with gr.Column(): | |
auth_openai_input = gr.Textbox(label="OpenAI Auth Key", max_lines=1, type='password') | |
auth_eleven_input = gr.Textbox(label="Eleven Labs Auth Key", max_lines=1, type='password') | |
auth_replicate_input = gr.Textbox(label="Replicate Auth Key", max_lines=1, type='password') | |
auth_rev_input = gr.Textbox(label="Rev AI Auth Key", max_lines=1, type='password') | |
prompt_input = gr.Textbox(label="Write me a story about...", lines=5) | |
generate_button = gr.Button("Generate Video") | |
with gr.Column(): | |
video_out = gr.Video(label="Output", interactive=False) | |
download_button = gr.Button("Download") | |
generate_button.click(generate_video, inputs=[prompt_input, auth_openai_input, auth_eleven_input, auth_replicate_input, auth_rev_input], outputs=[video_out]) | |
download_button.click(download_video, inputs=video_out) | |
demo.launch(debug=True, enable_queue=True) | |