Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -114,8 +114,10 @@ def get_duration(image,
|
|
114 |
seed,
|
115 |
progress):
|
116 |
"""Calculate dynamic GPU duration based on parameters."""
|
117 |
-
if
|
118 |
-
return
|
|
|
|
|
119 |
elif sampling_steps < 35 or duration_seconds < 2:
|
120 |
return 105
|
121 |
else:
|
@@ -129,10 +131,10 @@ def generate_video(
|
|
129 |
height,
|
130 |
width,
|
131 |
duration_seconds,
|
132 |
-
sampling_steps,
|
133 |
-
guide_scale,
|
134 |
-
shift,
|
135 |
-
seed,
|
136 |
progress=gr.Progress(track_tqdm=True)
|
137 |
):
|
138 |
"""The main function to generate video, called by the Gradio interface."""
|
@@ -238,7 +240,7 @@ with gr.Blocks(css=css, theme=gr.themes.Soft(), delete_cache=(60, 900)) as demo:
|
|
238 |
inputs=[image_input, prompt_input, height_input, width_input, duration_input],
|
239 |
outputs=video_output,
|
240 |
fn=generate_video,
|
241 |
-
cache_examples=
|
242 |
)
|
243 |
|
244 |
run_button.click(
|
|
|
114 |
seed,
|
115 |
progress):
|
116 |
"""Calculate dynamic GPU duration based on parameters."""
|
117 |
+
if duration_seconds >= 3:
|
118 |
+
return 220
|
119 |
+
elif sampling_steps > 35 and duration_seconds >= 2:
|
120 |
+
return 180
|
121 |
elif sampling_steps < 35 or duration_seconds < 2:
|
122 |
return 105
|
123 |
else:
|
|
|
131 |
height,
|
132 |
width,
|
133 |
duration_seconds,
|
134 |
+
sampling_steps=38,
|
135 |
+
guide_scale=cfg.sample_guide_scal,
|
136 |
+
shift=cfg.sample_shift,
|
137 |
+
seed=42,
|
138 |
progress=gr.Progress(track_tqdm=True)
|
139 |
):
|
140 |
"""The main function to generate video, called by the Gradio interface."""
|
|
|
240 |
inputs=[image_input, prompt_input, height_input, width_input, duration_input],
|
241 |
outputs=video_output,
|
242 |
fn=generate_video,
|
243 |
+
cache_examples="lazy",
|
244 |
)
|
245 |
|
246 |
run_button.click(
|