RamAnanth1 commited on
Commit
1f4dc2f
β€’
1 Parent(s): 64f7eff

Create gradio_t2v.py

Browse files
Files changed (1) hide show
  1. gradio_t2v.py +57 -0
gradio_t2v.py ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def create_demo(get_video):
4
+ block = gr.Blocks(css='style.css').queue()
5
+ with block:
6
+ gr.Markdown(DESCRIPTION)
7
+ with gr.Group():
8
+ with gr.Box():
9
+ with gr.Row(elem_id='prompt-container').style(equal_height=True):
10
+ prompt = gr.Text(
11
+ label='Prompt',
12
+ show_label=False,
13
+ max_lines=1,
14
+ placeholder='Enter your prompt',
15
+ elem_id='prompt-text-input').style(container=False)
16
+ run_button = gr.Button('Generate video').style(
17
+ full_width=False)
18
+ result = gr.Video(label='Result', show_label=False, elem_id='gallery')
19
+ with gr.Accordion('Advanced options', open=False):
20
+ seed = gr.Slider(
21
+ label='Seed',
22
+ minimum=-1,
23
+ maximum=1000000,
24
+ step=1,
25
+ value=-1,
26
+ info='If set to -1, a different seed will be used each time.')
27
+ # num_frames = gr.Slider(
28
+ # label='Number of frames',
29
+ # minimum=16,
30
+ # maximum=MAX_NUM_FRAMES,
31
+ # step=1,
32
+ # value=16,
33
+ # info=
34
+ # 'Note that the content of the video also changes when you change the number of frames.'
35
+ # )
36
+ # num_inference_steps = gr.Slider(label='Number of inference steps',
37
+ # minimum=10,
38
+ # maximum=50,
39
+ # step=1,
40
+ # value=25)
41
+
42
+ inputs = [
43
+ prompt,
44
+ seed,
45
+ # num_frames,
46
+ # num_inference_steps,
47
+ ]
48
+ gr.Examples(examples=[["Astronaut riding a horse", 10431]],
49
+ inputs=inputs,
50
+ outputs=result,
51
+ fn=get_video,
52
+ cache_examples=True)
53
+
54
+ prompt.submit(fn=get_video, inputs=inputs, outputs=result)
55
+ run_button.click(fn=get_video, inputs=inputs, outputs=result)
56
+
57
+ return block