GiorgioV commited on
Commit
1d6576a
·
verified ·
1 Parent(s): 59fffeb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -142,13 +142,19 @@ def get_duration(
142
  randomize_seed,
143
  progress,
144
  ):
145
- BASE_FRAMES_HEIGHT_WIDTH = 81 * 832 * 624
146
- BASE_STEP_DURATION = 15
 
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 ** 1.5
151
- return 10 + int(steps) * step_duration
 
 
 
 
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(