fffiloni commited on
Commit
d090378
·
verified ·
1 Parent(s): 60532e3

Switch to blocks

Browse files
Files changed (1) hide show
  1. app_df.py +72 -30
app_df.py CHANGED
@@ -27,7 +27,7 @@ def generate_diffusion_forced_video(
27
  shift=8.0,
28
  inference_steps=30,
29
  use_usp=False,
30
- offload=False,
31
  fps=24,
32
  seed=None,
33
  prompt_enhancer=False,
@@ -128,32 +128,74 @@ def generate_diffusion_forced_video(
128
  resolution_options = ["540P", "720P"]
129
  model_options = ["Skywork/SkyReels-V2-DF-1.3B-540P"] # Update if there are more
130
 
131
- gr.Interface(
132
- fn=generate_diffusion_forced_video,
133
- inputs=[
134
- gr.Textbox(label="Prompt"),
135
- gr.Dropdown(choices=model_options, value=model_options[0], label="Model ID"),
136
- gr.Radio(choices=resolution_options, value="540P", label="Resolution", interactive=False),
137
- gr.Slider(minimum=16, maximum=200, value=97, step=1, label="Number of Frames"),
138
- gr.Image(type="filepath", label="Input Image (optional)"),
139
- gr.Number(label="AR Step", value=0),
140
- gr.Checkbox(label="Causal Attention"),
141
- gr.Number(label="Causal Block Size", value=1),
142
- gr.Number(label="Base Num Frames", value=97),
143
- gr.Number(label="Overlap History (set for long videos)", value=None),
144
- gr.Number(label="AddNoise Condition", value=0),
145
- gr.Slider(minimum=1.0, maximum=20.0, value=6.0, step=0.1, label="Guidance Scale"),
146
- gr.Slider(minimum=0.0, maximum=20.0, value=8.0, step=0.1, label="Shift"),
147
- gr.Slider(minimum=1, maximum=100, value=30, step=1, label="Inference Steps"),
148
- gr.Checkbox(label="Use USP"),
149
- gr.Checkbox(label="Offload", value=True, interactive=False),
150
- gr.Slider(minimum=1, maximum=60, value=24, step=1, label="FPS"),
151
- gr.Number(label="Seed (optional)", precision=0),
152
- gr.Checkbox(label="Prompt Enhancer"),
153
- gr.Checkbox(label="Use TeaCache"),
154
- gr.Slider(minimum=0.0, maximum=1.0, value=0.2, step=0.01, label="TeaCache Threshold"),
155
- gr.Checkbox(label="Use Retention Steps"),
156
- ],
157
- outputs=gr.Video(label="Generated Video"),
158
- title="SkyReels V2 Diffusion Forcing"
159
- ).launch(show_error=True, show_api=False, share=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
  shift=8.0,
28
  inference_steps=30,
29
  use_usp=False,
30
+ offload=True,
31
  fps=24,
32
  seed=None,
33
  prompt_enhancer=False,
 
128
  resolution_options = ["540P", "720P"]
129
  model_options = ["Skywork/SkyReels-V2-DF-1.3B-540P"] # Update if there are more
130
 
131
+ with gr.Blocks() as demo:
132
+ with gr.Column():
133
+ gr.Markdown("# SkyReels V2")
134
+
135
+ with gr.Row():
136
+
137
+ with gr.Column():
138
+
139
+ prompt = gr.Textbox(label="Prompt")
140
+ model_id = gr.Dropdown(choices=model_options, value=model_options[0], label="Model ID")
141
+ resolution = gr.Radio(choices=resolution_options, value="540P", label="Resolution", interactive=False)
142
+ num_frames = gr.Slider(minimum=16, maximum=200, value=97, step=1, label="Number of Frames")
143
+ image = gr.Image(type="filepath", label="Input Image (optional)")
144
+
145
+ with gr.Accordion("Advanced Settings", open=False):
146
+ ar_step = gr.Number(label="AR Step", value=0)
147
+ causal_attention = gr.Checkbox(label="Causal Attention")
148
+ causal_block_size = gr.Number(label="Causal Block Size", value=1)
149
+ base_num_frames = gr.Number(label="Base Num Frames", value=97)
150
+ overlap_history = gr.Number(label="Overlap History (set for long videos)", value=None)
151
+ addnoise_condition = gr.Number(label="AddNoise Condition", value=0)
152
+ guidance_scale = gr.Slider(minimum=1.0, maximum=20.0, value=6.0, step=0.1, label="Guidance Scale")
153
+ shift = gr.Slider(minimum=0.0, maximum=20.0, value=8.0, step=0.1, label="Shift")
154
+ inference_steps = gr.Slider(minimum=1, maximum=100, value=30, step=1, label="Inference Steps")
155
+ use_usp = gr.Checkbox(label="Use USP")
156
+ offload = gr.Checkbox(label="Offload", value=True, interactive=False)
157
+ fps = gr.Slider(minimum=1, maximum=60, value=24, step=1, label="FPS")
158
+ seed = gr.Number(label="Seed (optional)", precision=0)
159
+ prompt_enhancer = gr.Checkbox(label="Prompt Enhancer")
160
+ use_teacache = gr.Checkbox(label="Use TeaCache")
161
+ teacache_thresh = gr.Slider(minimum=0.0, maximum=1.0, value=0.2, step=0.01, label="TeaCache Threshold")
162
+ use_ret_steps = gr.Checkbox(label="Use Retention Steps")
163
+
164
+ submit_btn = gr.Button("Generate")
165
+
166
+ with gr.Column():
167
+
168
+ output_video = gr.Video(label="Generated Video")
169
+
170
+ submit_btn.click(
171
+ fn = generate_diffusion_forced_video,
172
+ inputs = [
173
+ prompt,
174
+ model_id,
175
+ resolution,
176
+ num_frames,
177
+ image,
178
+ ar_step,
179
+ causal_attention,
180
+ causal_block_size,
181
+ base_num_frames,
182
+ overlap_history,
183
+ addnoise_condition,
184
+ guidance_scale,
185
+ shift,
186
+ inference_steps,
187
+ use_usp,
188
+ offload,
189
+ fps,
190
+ seed,
191
+ prompt_enhancer,
192
+ teacache,
193
+ teacache_thresh,
194
+ use_ret_steps
195
+ ],
196
+ outputs = [
197
+ output_video
198
+ ]
199
+ )
200
+
201
+ demo.launch(show_error=True, show_api=False, share=False)