Spaces:
Running
on
Zero
Running
on
Zero
change gpu duration calculation to dynamically adapt to the number of inference steps (#1)
Browse files- change gpu duration calculation to dynamically adapt to the number of inference steps (30cdb92602b846b583c0780733d259974c0a50a0)
Co-authored-by: Linoy Tsaban <[email protected]>
app.py
CHANGED
|
@@ -84,12 +84,10 @@ def get_duration(input_image, prompt, height, width,
|
|
| 84 |
guidance_scale, steps,
|
| 85 |
seed, randomize_seed,
|
| 86 |
progress):
|
| 87 |
-
if
|
| 88 |
-
return
|
| 89 |
-
elif steps > 4 or duration_seconds > 2:
|
| 90 |
-
return 75
|
| 91 |
else:
|
| 92 |
-
return
|
| 93 |
|
| 94 |
@spaces.GPU(duration=get_duration)
|
| 95 |
def generate_video(input_image, prompt, height, width,
|
|
|
|
| 84 |
guidance_scale, steps,
|
| 85 |
seed, randomize_seed,
|
| 86 |
progress):
|
| 87 |
+
if duration_seconds <= 2.5
|
| 88 |
+
return steps * 18
|
|
|
|
|
|
|
| 89 |
else:
|
| 90 |
+
return steps * 25
|
| 91 |
|
| 92 |
@spaces.GPU(duration=get_duration)
|
| 93 |
def generate_video(input_image, prompt, height, width,
|