RamAnanth1 commited on
Commit
0e8aba4
β€’
1 Parent(s): a7d07c3

Create gradio_videocontrol.py

Browse files
Files changed (1) hide show
  1. gradio_videocontrol.py +51 -0
gradio_videocontrol.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def create_demo(get_video_control):
4
+ block = gr.Blocks(css='style.css').queue()
5
+ with block:
6
+ with gr.Group():
7
+ with gr.Box():
8
+ prompt = gr.Text(
9
+ label='Prompt',
10
+ show_label=False,
11
+ max_lines=1,
12
+ placeholder='Enter your prompt',
13
+ elem_id='prompt-text-input').style(container=False)
14
+ run_button = gr.Button('Generate video').style(
15
+ full_width=False)
16
+ input_video = gr.Video(label='Input Video')
17
+
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
+ sampling_steps = gr.Slider(label='Number of sampling steps',
28
+ minimum=10,
29
+ maximum=100,
30
+ step=5,
31
+ value=50)
32
+
33
+ inputs = [
34
+ prompt,
35
+ input_video
36
+ seed,
37
+ sampling_steps
38
+ # num_frames,
39
+ # num_inference_steps,
40
+ ]
41
+ gr.Examples(examples=[
42
+ ],
43
+ inputs=inputs,
44
+ outputs=result,
45
+ fn=get_video_control,
46
+ cache_examples=True)
47
+
48
+ prompt.submit(fn=get_video_control, inputs=inputs, outputs=result)
49
+ run_button.click(fn=get_video_control, inputs=inputs, outputs=result)
50
+
51
+ return block