HAL1993 commited on
Commit
5776815
·
verified ·
1 Parent(s): 498c5da

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -141,16 +141,30 @@ def get_num_frames(duration_seconds: float):
141
  MAX_FRAMES_MODEL,
142
  ))
143
 
144
- def get_duration(input_image, prompt, steps, negative_prompt, duration_seconds, guidance_scale, guidance_scale_2, seed, randomize_seed, progress):
 
 
 
 
 
 
 
 
 
 
 
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(
155
  input_image,
156
  prompt,
 
141
  MAX_FRAMES_MODEL,
142
  ))
143
 
144
+ def get_duration(
145
+ input_image,
146
+ prompt,
147
+ steps,
148
+ negative_prompt,
149
+ duration_seconds,
150
+ guidance_scale,
151
+ guidance_scale_2,
152
+ seed,
153
+ randomize_seed,
154
+ progress,
155
+ ):
156
  BASE_FRAMES_HEIGHT_WIDTH = 81 * 832 * 624
157
  BASE_STEP_DURATION = 15
158
  width, height = resize_image(input_image).size
159
  frames = get_num_frames(duration_seconds)
160
  factor = frames * width * height / BASE_FRAMES_HEIGHT_WIDTH
161
  step_duration = BASE_STEP_DURATION * factor ** 1.5
162
+ est = 10 + int(steps) * step_duration
163
+
164
+ MAX_ALLOWED = 30
165
+ return min(est, MAX_ALLOWED)
166
 
167
+ @spaces.GPU
168
  def generate_video(
169
  input_image,
170
  prompt,