ihsanvp commited on
Commit
7acc91c
1 Parent(s): 0593b2c

fix: progress update on step

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -44,14 +44,14 @@ def generate(prompt: str, progress=gr.Progress()):
44
  num_inference_steps=n_steps,
45
  denoising_end=high_noise_frac,
46
  output_type="latent",
47
- callback=lambda s, t, d: progress((s, 100), desc="Generating first frame..."),
48
  ).images[0]
49
  image = refiner(
50
  prompt=prompt,
51
  num_inference_steps=n_steps,
52
  denoising_start=high_noise_frac,
53
  image=image,
54
- callback=lambda s, t, d: progress((s+40, 100), desc="Refining first frame..."),
55
  ).images[0]
56
  image = to_tensor(image)
57
  frames: list[Image.Image] = pipeline(
@@ -62,7 +62,7 @@ def generate(prompt: str, progress=gr.Progress()):
62
  guidance_scale=9.0,
63
  generator=generator,
64
  decode_chunk_size=10,
65
- callback=lambda s, t, d: progress((s+50, 100), desc="Generating video..."),
66
  ).frames[0]
67
  frames = [to_tensor(frame.convert("RGB")).mul(255).byte().permute(1, 2, 0) for frame in frames]
68
  frames = torch.stack(frames)
 
44
  num_inference_steps=n_steps,
45
  denoising_end=high_noise_frac,
46
  output_type="latent",
47
+ callback_on_step_end=lambda p, s, t, d: progress((s, 100), desc="Generating first frame..."),
48
  ).images[0]
49
  image = refiner(
50
  prompt=prompt,
51
  num_inference_steps=n_steps,
52
  denoising_start=high_noise_frac,
53
  image=image,
54
+ callback_on_step_end=lambda p, s, t, d: progress((s+40, 100), desc="Refining first frame..."),
55
  ).images[0]
56
  image = to_tensor(image)
57
  frames: list[Image.Image] = pipeline(
 
62
  guidance_scale=9.0,
63
  generator=generator,
64
  decode_chunk_size=10,
65
+ callback_on_step_end=lambda p, s, t, d: progress((s+50, 100), desc="Generating video..."),
66
  ).frames[0]
67
  frames = [to_tensor(frame.convert("RGB")).mul(255).byte().permute(1, 2, 0) for frame in frames]
68
  frames = torch.stack(frames)