Fabrice-TIERCELIN commited on
Commit
fc0ab86
·
verified ·
1 Parent(s): 1d3aaa5

Allocation time

Browse files
Files changed (1) hide show
  1. app.py +31 -17
app.py CHANGED
@@ -193,7 +193,13 @@ def generate_video(
193
  randomize_seed=False,
194
  progress=gr.Progress(track_tqdm=True)
195
  ):
196
- return generate_video(
 
 
 
 
 
 
197
  start_image_pil,
198
  end_image_pil,
199
  prompt,
@@ -207,31 +213,39 @@ def generate_video(
207
  progress
208
  )
209
 
210
- @spaces.GPU(duration=120)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
211
  def generate_video_on_gpu(
212
  start_image_pil,
213
  end_image_pil,
214
  prompt,
215
- negative_prompt=default_negative_prompt,
216
- duration_seconds=2.1,
217
- steps=8,
218
- guidance_scale=1,
219
- guidance_scale_2=1,
220
- seed=42,
221
- randomize_seed=False,
222
- progress=gr.Progress(track_tqdm=True)
223
  ):
224
  """
225
  Generates a video by interpolating between a start and end image, guided by a text prompt,
226
  using the diffusers Wan2.2 pipeline.
227
  """
228
- if input_image_debug_value[0] is not None or end_image_debug_value[0] is not None or prompt_debug_value[0] is not None or total_second_length_debug_value[0] is not None:
229
- start_image_pil = input_image_debug_value[0]
230
- end_image_pil = end_image_debug_value[0]
231
- prompt = prompt_debug_value[0]
232
- duration_seconds = total_second_length_debug_value[0]
233
- #allocation_time = min(total_second_length_debug_value[0] * 60 * 100, 600)
234
-
235
  if start_image_pil is None or end_image_pil is None:
236
  raise gr.Error("Please upload both a start and an end image.")
237
 
 
193
  randomize_seed=False,
194
  progress=gr.Progress(track_tqdm=True)
195
  ):
196
+ if input_image_debug_value[0] is not None or end_image_debug_value[0] is not None or prompt_debug_value[0] is not None or total_second_length_debug_value[0] is not None:
197
+ start_image_pil = input_image_debug_value[0]
198
+ end_image_pil = end_image_debug_value[0]
199
+ prompt = prompt_debug_value[0]
200
+ duration_seconds = min(total_second_length_debug_value[0] * 60 * 100, 600)
201
+
202
+ return generate_video_on_gpu(
203
  start_image_pil,
204
  end_image_pil,
205
  prompt,
 
213
  progress
214
  )
215
 
216
+ def get_duration(
217
+ start_image_pil,
218
+ end_image_pil,
219
+ prompt,
220
+ negative_prompt,
221
+ duration_seconds,
222
+ steps,
223
+ guidance_scale,
224
+ guidance_scale_2,
225
+ seed,
226
+ randomize_seed,
227
+ progress
228
+ ):
229
+ return duration_seconds
230
+
231
+ @spaces.GPU(duration=get_duration)
232
  def generate_video_on_gpu(
233
  start_image_pil,
234
  end_image_pil,
235
  prompt,
236
+ negative_prompt,
237
+ duration_seconds,
238
+ steps,
239
+ guidance_scale,
240
+ guidance_scale_2,
241
+ seed,
242
+ randomize_seed,
243
+ progress
244
  ):
245
  """
246
  Generates a video by interpolating between a start and end image, guided by a text prompt,
247
  using the diffusers Wan2.2 pipeline.
248
  """
 
 
 
 
 
 
 
249
  if start_image_pil is None or end_image_pil is None:
250
  raise gr.Error("Please upload both a start and an end image.")
251