vilarin commited on
Commit
a9fe87b
·
verified ·
1 Parent(s): 218b00f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -49,6 +49,8 @@ def generate(
49
  seed: Optional[int] = -1,
50
  motion_bucket_id: int = 127,
51
  fps_id: int = 25,
 
 
52
  output_folder: str = "outputs",
53
  progress=gr.Progress(track_tqdm=True)):
54
 
@@ -65,12 +67,12 @@ def generate(
65
 
66
  frames = pipe(
67
  input_image=image.resize((512, 512)),
68
- num_frames=128,
69
  fps=fps_id,
70
  height=512,
71
  width=512,
72
  motion_bucket_id=motion_bucket_id,
73
- num_inference_steps=50,
74
  min_cfg_scale=2,
75
  max_cfg_scale=2,
76
  contrast_enhance_scale=1.2
@@ -110,20 +112,36 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
110
  label="Motion bucket id",
111
  info="Controls how much motion to add/remove from the image",
112
  value=127,
 
113
  minimum=1,
114
  maximum=255
115
  )
116
  fps_id = gr.Slider(
117
  label="Frames per second",
118
  info="The length of your video in seconds will be 25/fps",
119
- value=6,
 
120
  minimum=5,
121
  maximum=30
122
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  with gr.Row():
124
  submit_btn = gr.Button(value="Generate")
125
- stop_btn = gr.Button(variant="stop")
126
- clear_btn = gr.ClearButton([image, seed, video])
127
  gr.Examples(
128
  examples=examples,
129
  inputs=image,
@@ -133,7 +151,7 @@ with gr.Blocks(css=CSS, js=JS, theme="soft") as demo:
133
  examples_per_page=4,
134
  )
135
 
136
- submit_event = submit_btn.click(fn=generate, inputs=[image, seed, motion_bucket_id, fps_id], outputs=[video, seed], api_name="video")
137
- stop_btn.click(lambda _: gr.update(interactive=False), None, stop_btn, cancels=[submit_event])
138
 
139
  demo.queue().launch()
 
49
  seed: Optional[int] = -1,
50
  motion_bucket_id: int = 127,
51
  fps_id: int = 25,
52
+ num_inference_steps: int = 25,
53
+ num_frames: int = 128,
54
  output_folder: str = "outputs",
55
  progress=gr.Progress(track_tqdm=True)):
56
 
 
67
 
68
  frames = pipe(
69
  input_image=image.resize((512, 512)),
70
+ num_frames=num_frames,
71
  fps=fps_id,
72
  height=512,
73
  width=512,
74
  motion_bucket_id=motion_bucket_id,
75
+ num_inference_steps=num_inference_steps,
76
  min_cfg_scale=2,
77
  max_cfg_scale=2,
78
  contrast_enhance_scale=1.2
 
112
  label="Motion bucket id",
113
  info="Controls how much motion to add/remove from the image",
114
  value=127,
115
+ step=1,
116
  minimum=1,
117
  maximum=255
118
  )
119
  fps_id = gr.Slider(
120
  label="Frames per second",
121
  info="The length of your video in seconds will be 25/fps",
122
+ value=6,
123
+ step=1,
124
  minimum=5,
125
  maximum=30
126
  )
127
+ num_inference_steps = gr.Slider(
128
+ label="Inference steps",
129
+ info="Inference steps",
130
+ value=25,
131
+ minimum=1,
132
+ maximum=50
133
+ )
134
+ num_frames = gr.Slider(
135
+ label="Frames num",
136
+ info="Frames num",
137
+ value=25,
138
+ minimum=1,
139
+ maximum=50
140
+ )
141
  with gr.Row():
142
  submit_btn = gr.Button(value="Generate")
143
+ stop_btn = gr.Button(value="Stop", variant="stop")
144
+ #clear_btn = gr.ClearButton([image, seed, video])
145
  gr.Examples(
146
  examples=examples,
147
  inputs=image,
 
151
  examples_per_page=4,
152
  )
153
 
154
+ submit_event = submit_btn.click(fn=generate, inputs=[image, seed, motion_bucket_id, fps_id,num_inference_steps, num_frames], outputs=[video, seed], api_name="video")
155
+ #stop_btn.click(lambda _: gr.update(interactive=False), None, stop_btn, cancels=[submit_event])
156
 
157
  demo.queue().launch()