Spaces:
Sleeping
Sleeping
File size: 1,769 Bytes
0af4580 a37d72d e3db800 0af4580 0d80a43 0af4580 f1c473c 99500b3 0af4580 9d6eb99 0af4580 0d80a43 9d6eb99 27938b7 d510b6e 0af4580 d510b6e 0af4580 d510b6e 27938b7 fa240bf 67dce58 d510b6e 27938b7 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 |
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)
|