File size: 1,321 Bytes
714bf26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from model import Model

examples = [
    "an astronaut waving the arm on the moon",
    "a sloth surfing on a wakeboard",
            "an astronaut walking on a street",
            "a cute cat walking on grass",
    "a horse is galloping on a street",
   "an astronaut is skiing down the hill",
    "a gorilla walking alone down the street"
    "a gorilla dancing on times square",
    "A panda dancing dancing like crazy on Times Square",
    ]


def create_demo(model: Model):

    with gr.Blocks() as demo:
        with gr.Row():
            gr.Markdown('## Text2Video-Zero: Video Generation')

        with gr.Row():
            with gr.Column():
                prompt = gr.Textbox(label='Prompt')
                run_button = gr.Button(label='Run')
            with gr.Column():
                result = gr.Video(label="Generated Video")
        inputs = [
            prompt, 
        ]

        gr.Examples(examples=examples,
                inputs=inputs,
                outputs=result,
                cache_examples=False,
                #cache_examples=os.getenv('SYSTEM') == 'spaces')
                run_on_click=False,
        )

        run_button.click(fn=model.process_text2video,
                         inputs=inputs,
                         outputs=result,)
    return demo