Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -142,13 +142,19 @@ def get_duration(
|
|
| 142 |
randomize_seed,
|
| 143 |
progress,
|
| 144 |
):
|
| 145 |
-
BASE_FRAMES_HEIGHT_WIDTH =
|
| 146 |
-
BASE_STEP_DURATION =
|
|
|
|
| 147 |
width, height = resize_image(input_image).size
|
| 148 |
frames = get_num_frames(duration_seconds)
|
|
|
|
| 149 |
factor = frames * width * height / BASE_FRAMES_HEIGHT_WIDTH
|
| 150 |
-
step_duration = BASE_STEP_DURATION * factor
|
| 151 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 152 |
|
| 153 |
@spaces.GPU(duration=get_duration)
|
| 154 |
def generate_video(
|
|
|
|
| 142 |
randomize_seed,
|
| 143 |
progress,
|
| 144 |
):
|
| 145 |
+
BASE_FRAMES_HEIGHT_WIDTH = 120 * 640 * 480
|
| 146 |
+
BASE_STEP_DURATION = 10
|
| 147 |
+
|
| 148 |
width, height = resize_image(input_image).size
|
| 149 |
frames = get_num_frames(duration_seconds)
|
| 150 |
+
|
| 151 |
factor = frames * width * height / BASE_FRAMES_HEIGHT_WIDTH
|
| 152 |
+
step_duration = BASE_STEP_DURATION * factor
|
| 153 |
+
|
| 154 |
+
estimated_duration = 10 + int(steps) * step_duration
|
| 155 |
+
MAX_ALLOWED_DURATION = 120
|
| 156 |
+
|
| 157 |
+
return min(estimated_duration, MAX_ALLOWED_DURATION)
|
| 158 |
|
| 159 |
@spaces.GPU(duration=get_duration)
|
| 160 |
def generate_video(
|