Spaces:
Sleeping
Sleeping
| import animation | |
| import bgm | |
| import join | |
| 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) | |
| deforum_str, max_frames = subtitles.audio2subtitle(auth_rev) | |
| 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) | |
| generated_video = join.join_artifacts() | |
| return [generated_video, generated_video] | |
| 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="Video Player", interactive=False) | |
| output_file = gr.File(label="File Output") | |
| output_file.type = "video/mp4" | |
| generate_button.click(generate_video, inputs=[prompt_input, auth_openai_input, auth_eleven_input, auth_replicate_input, auth_rev_input], outputs=[video_out, output_file]) | |
| demo.launch(debug=True, enable_queue=True) | |