multimodalart HF staff commited on
Commit
0fde759
1 Parent(s): 57dc421

round of updates for making it usable (#8)

Browse files

- round of updates for making it usable (0615684f9b713cd73ba505acffda8a3d6fcdc494)

Files changed (1) hide show
  1. app.py +9 -5
app.py CHANGED
@@ -25,7 +25,7 @@ snapshot_download(repo_id="zcxu-eric/MagicAnimate", local_dir="./MagicAnimate")
25
 
26
  animator = MagicAnimate()
27
 
28
- def animate(reference_image, motion_sequence_state, seed, steps, guidance_scale):
29
  return animator(reference_image, motion_sequence_state, seed, steps, guidance_scale)
30
 
31
  with gr.Blocks() as demo:
@@ -70,13 +70,15 @@ with gr.Blocks() as demo:
70
  motion_sequence.upload(
71
  read_video,
72
  motion_sequence,
73
- motion_sequence
 
74
  )
75
  # when `first_frame` is updated
76
  reference_image.upload(
77
  read_image,
78
  reference_image,
79
- reference_image
 
80
  )
81
  # when the `submit` button is clicked
82
  submit.click(
@@ -88,6 +90,7 @@ with gr.Blocks() as demo:
88
  # Examples
89
  gr.Markdown("## Examples")
90
  gr.Examples(
 
91
  examples=[
92
  ["inputs/applications/source_image/monalisa.png", "inputs/applications/driving/densepose/running.mp4"],
93
  ["inputs/applications/source_image/demo4.png", "inputs/applications/driving/densepose/demo4.mp4"],
@@ -97,8 +100,9 @@ with gr.Blocks() as demo:
97
  ["inputs/applications/source_image/multi1_source.png", "inputs/applications/driving/densepose/multi_dancing.mp4"],
98
  ],
99
  inputs=[reference_image, motion_sequence],
100
- outputs=animation
 
101
  )
102
 
103
- demo.queue(max_size=100)
104
  demo.launch(share=True)
 
25
 
26
  animator = MagicAnimate()
27
 
28
+ def animate(reference_image, motion_sequence_state, seed=1, steps=25, guidance_scale=7.5):
29
  return animator(reference_image, motion_sequence_state, seed, steps, guidance_scale)
30
 
31
  with gr.Blocks() as demo:
 
70
  motion_sequence.upload(
71
  read_video,
72
  motion_sequence,
73
+ motion_sequence,
74
+ queue=False
75
  )
76
  # when `first_frame` is updated
77
  reference_image.upload(
78
  read_image,
79
  reference_image,
80
+ reference_image,
81
+ queue=False
82
  )
83
  # when the `submit` button is clicked
84
  submit.click(
 
90
  # Examples
91
  gr.Markdown("## Examples")
92
  gr.Examples(
93
+ fn=animate,
94
  examples=[
95
  ["inputs/applications/source_image/monalisa.png", "inputs/applications/driving/densepose/running.mp4"],
96
  ["inputs/applications/source_image/demo4.png", "inputs/applications/driving/densepose/demo4.mp4"],
 
100
  ["inputs/applications/source_image/multi1_source.png", "inputs/applications/driving/densepose/multi_dancing.mp4"],
101
  ],
102
  inputs=[reference_image, motion_sequence],
103
+ outputs=animation,
104
+ cache_examples=True
105
  )
106
 
107
+ demo.queue(max_size=15)
108
  demo.launch(share=True)