File size: 1,878 Bytes
d510b6e
0d80a43
d510b6e
0d80a43
d510b6e
 
 
 
 
 
 
 
 
0d80a43
d510b6e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
42
43
44
45
46
import numpy as np
import gradio as gr
import os

def show_textbox(radio_state):
    if(radio_state == "User Input"):
        return [gr.Textbox.update(visible=False), gr.Textbox.update(visible=False), gr.Textbox.update(visible=True)]
    elif(radio_state == "ChatGPT"):
        return [gr.Textbox.update(visible=True), gr.Textbox.update(visible=True), gr.Textbox.update(visible=False)]
    elif(radio_state == "PlaceholderModel"):
        return [gr.Textbox.update(visible=True), gr.Textbox.update(visible=True), gr.Textbox.update(visible=False)]
    else:
        return [gr.Textbox.update(visible=False) for _ in range(3)]

def generate_video(x):
    return x

def download_video(v):
    pass

with gr.Blocks() as demo:
    gr.Markdown("Generate a narrated horror story video from a text prompt or your own story.")

    with gr.Row():
        with gr.Column():
            radio_input = gr.Radio(["ChatGPT", "PlaceholderModel", "User Input"], type="value", label="Input method")
            auth_input = gr.Textbox(label="Auth Key", max_lines=1, visible=False, interactive=True)
            prompt_input = gr.Textbox(label="Prompt", lines=5, visible=False, interactive=True)
            text_input = gr.Textbox(label="Your Story", lines=5, visible=False, interactive=True)

            text_lst = [auth_input, prompt_input, text_input]
            radio_input.change(show_textbox, radio_input, text_lst)

            generate_button = gr.Button("Generate Video")

        with gr.Column():
            out_path = os.path.join(os.path.dirname(os.getcwd()), "fearflixai/src","example.mp4")
            print(out_path)
            video_out = gr.PlayableVideo(out_path)
            download_button = gr.Button("Download")

    generate_button.click(generate_video, inputs=video_out, outputs=video_out)
    download_button.click(download_video, inputs=video_out)

demo.launch()