Spaces:
Sleeping
Sleeping
File size: 1,751 Bytes
0af4580 a37d72d 0af4580 0d80a43 0af4580 0d80a43 0af4580 d510b6e 0af4580 d510b6e 0af4580 d510b6e a37d72d d510b6e 0af4580 d510b6e a37d72d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
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)
|