PeterL1n commited on
Commit
20b95d1
1 Parent(s): 006c2e8
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -30,7 +30,7 @@ pipe.scheduler = EulerDiscreteScheduler.from_config(pipe.scheduler.config, times
30
 
31
  # Function
32
  @spaces.GPU(enable_queue=True)
33
- def generate_image(prompt, base, motion, step):
34
  global step_loaded
35
  global base_loaded
36
  global motion_loaded
@@ -53,7 +53,11 @@ def generate_image(prompt, base, motion, step):
53
  pipe.set_adapters(["motion"], [0.7])
54
  motion_loaded = motion
55
 
56
- output = pipe(prompt=prompt, guidance_scale=1.0, num_inference_steps=step)
 
 
 
 
57
  name = str(uuid.uuid4()).replace("-", "")
58
  path = f"/tmp/{name}.mp4"
59
  export_to_video(output.frames[0], path, fps=10)
 
30
 
31
  # Function
32
  @spaces.GPU(enable_queue=True)
33
+ def generate_image(prompt, base, motion, step, progress=gr.Progress()):
34
  global step_loaded
35
  global base_loaded
36
  global motion_loaded
 
53
  pipe.set_adapters(["motion"], [0.7])
54
  motion_loaded = motion
55
 
56
+ progress((0, step))
57
+ def progress_callback(i, t, z):
58
+ progress((i+1, step))
59
+
60
+ output = pipe(prompt=prompt, guidance_scale=1.0, num_inference_steps=step, callback=progress_callback)
61
  name = str(uuid.uuid4()).replace("-", "")
62
  path = f"/tmp/{name}.mp4"
63
  export_to_video(output.frames[0], path, fps=10)