File size: 2,256 Bytes
42eaaf0
 
63526ee
 
42eaaf0
 
 
 
 
 
 
 
 
 
 
 
c200095
63526ee
42eaaf0
c200095
42eaaf0
 
 
 
 
 
 
 
 
f7f313b
 
 
 
 
42eaaf0
 
 
 
63526ee
 
42eaaf0
 
 
63526ee
42eaaf0
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
import gradio as gr 

lora_list = ["Loving Vincent","Frozen","MakotoShinkai YourName","Coco" ]

def create_demo(get_video_lora):
    block = gr.Blocks(css='style.css').queue()
    with block:
        with gr.Group():
            with gr.Box():
                with gr.Row(elem_id='prompt-container').style(equal_height=True):
                    prompt = gr.Text(
                        label='Prompt',
                        show_label=False,
                        max_lines=1,
                        placeholder='Enter your prompt',
                        elem_id='prompt-text-input').style(container=False)
                with gr.Row(elem_id='prompt-container').style(equal_height=True):
                    model_choice = gr.Dropdown(choices=lora_list, value=lora_list[0], label='Model Style')
                    run_button = gr.Button('Generate video').style(
                            full_width=False)
            result = gr.Video(label='Result', show_label=False, elem_id='gallery')
            with gr.Accordion('Advanced options', open=False):
                seed = gr.Slider(
                    label='Seed',
                    minimum=-1,
                    maximum=1000000,
                    step=1,
                    value=-1,
                    info='If set to -1, a different seed will be used each time.')
                sampling_steps = gr.Slider(label='Number of sampling steps',
                                                minimum=10,
                                                maximum=100,
                                                step=5,
                                                value=50)
    
        inputs = [
            prompt,
            seed,
            sampling_steps,
            model_choice
            # num_frames,
            # num_inference_steps,
        ]
        gr.Examples(examples=[["A monkey is playing a piano", 1431,50, "Frozen"]],
                    inputs=inputs,
                    outputs=result,
                    fn=get_video_lora,
                    cache_examples=True)
    
        prompt.submit(fn=get_video_lora, inputs=inputs, outputs=result)
        run_button.click(fn=get_video_lora, inputs=inputs, outputs=result)
        
        return block