Spaces:
Sleeping
Sleeping
LittleLirow
commited on
Commit
·
0af4580
1
Parent(s):
aa4d9a4
Update main gradio block
Browse files
app.py
CHANGED
@@ -1,34 +1,32 @@
|
|
|
|
1 |
import bgm
|
|
|
|
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
return [gr.Textbox.update(visible=False) for _ in range(2)]
|
11 |
|
12 |
-
|
13 |
-
ambient_music = bgm.text2audio(text=text_in, duration=20, guidance_scale=5, random_seed=24, n_candidates=3)
|
14 |
-
print(ambient_music)
|
15 |
-
return ambient_music
|
16 |
|
17 |
def download_video(v):
|
18 |
pass
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
-
gr.Markdown("Generate a narrated horror story video from a text prompt
|
22 |
|
23 |
with gr.Row():
|
24 |
with gr.Column():
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
text_lst = [auth_input, prompt_input, text_input]
|
31 |
-
radio_input.change(show_textbox, radio_input, text_lst)
|
32 |
|
33 |
generate_button = gr.Button("Generate Video")
|
34 |
|
@@ -36,7 +34,7 @@ with gr.Blocks() as demo:
|
|
36 |
video_out = gr.Video(label="Output", interactive=False)
|
37 |
download_button = gr.Button("Download")
|
38 |
|
39 |
-
generate_button.click(generate_video, inputs=[
|
40 |
download_button.click(download_video, inputs=video_out)
|
41 |
|
42 |
demo.launch(debug=True, enable_queue=True)
|
|
|
1 |
+
import animation
|
2 |
import bgm
|
3 |
+
import narrator
|
4 |
+
import story
|
5 |
+
import subtitles
|
6 |
import gradio as gr
|
7 |
|
8 |
+
def generate_video(text, auth_openai, auth_elevenlabs, auth_replicate, auth_rev):
|
9 |
+
generated_story = story.text2story(text, auth_openai)
|
10 |
+
narrator.text2voice(generated_story, "audio_out.mp3", auth_elevenlabs, 5)
|
11 |
+
deforum_str, max_frames = subtitles.audio2subtitle(auth_rev)
|
12 |
+
generated_animation = animation.story2video(deforum_str, max_frames, auth_replicate)
|
13 |
+
# generated_music = bgm.text2audio(text=text, duration=20, guidance_scale=5, random_seed=24, n_candidates=3)
|
|
|
14 |
|
15 |
+
return generated_animation
|
|
|
|
|
|
|
16 |
|
17 |
def download_video(v):
|
18 |
pass
|
19 |
|
20 |
with gr.Blocks() as demo:
|
21 |
+
gr.Markdown("Generate a narrated horror story video from a text prompt.")
|
22 |
|
23 |
with gr.Row():
|
24 |
with gr.Column():
|
25 |
+
auth_openai_input = gr.Textbox(label="OpenAI Auth Key", max_lines=1, type='password')
|
26 |
+
auth_eleven_input = gr.Textbox(label="Eleven Labs Auth Key", max_lines=1, type='password')
|
27 |
+
auth_replicate_input = gr.Textbox(label="Replicate Auth Key", max_lines=1, type='password')
|
28 |
+
auth_rev_input = gr.Textbox(label="Rev AI Auth Key", max_lines=1, type='password')
|
29 |
+
prompt_input = gr.Textbox(label="Write me a story about...", lines=5)
|
|
|
|
|
30 |
|
31 |
generate_button = gr.Button("Generate Video")
|
32 |
|
|
|
34 |
video_out = gr.Video(label="Output", interactive=False)
|
35 |
download_button = gr.Button("Download")
|
36 |
|
37 |
+
generate_button.click(generate_video, inputs=[prompt_input, auth_openai_input, auth_eleven_input, auth_replicate_input, auth_rev_input], outputs=[video_out])
|
38 |
download_button.click(download_video, inputs=video_out)
|
39 |
|
40 |
demo.launch(debug=True, enable_queue=True)
|