hysts HF staff commited on
Commit
53097bd
1 Parent(s): 24e4b80
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -29,7 +29,7 @@ true_for_shared_ui = False #This will be true only if you are in a shared UI
29
  if(is_spaces):
30
  true_for_shared_ui = True if "zcxu-eric/magicanimate" in os.environ['SPACE_ID'] else False
31
 
32
-
33
  animator = MagicAnimate()
34
 
35
  def animate(reference_image, motion_sequence_state, seed=1, steps=25, guidance_scale=7.5):
@@ -54,11 +54,11 @@ with gr.Blocks() as demo:
54
  </div>
55
  """)
56
  animation = gr.Video(format="mp4", label="Animation Results", autoplay=True)
57
-
58
  with gr.Row():
59
  reference_image = gr.Image(label="Reference Image")
60
  motion_sequence = gr.Video(format="mp4", label="Motion Sequence",max_length=5)
61
-
62
  with gr.Column():
63
  random_seed = gr.Textbox(label="Random seed", value=1, info="default: -1")
64
  sampling_steps = gr.Textbox(label="Sampling steps", value=25, info="default: 25")
@@ -69,10 +69,10 @@ with gr.Blocks() as demo:
69
  reader = imageio.get_reader(video)
70
  fps = reader.get_meta_data()['fps']
71
  return video
72
-
73
  def read_image(image, size=512):
74
  return np.array(Image.fromarray(image).resize((size, size)))
75
-
76
  # when user uploads a new video
77
  motion_sequence.upload(
78
  read_video,
@@ -90,7 +90,7 @@ with gr.Blocks() as demo:
90
  # when the `submit` button is clicked
91
  submit.click(
92
  animate,
93
- [reference_image, motion_sequence, random_seed, sampling_steps, guidance_scale],
94
  animation
95
  )
96
 
@@ -110,5 +110,5 @@ with gr.Blocks() as demo:
110
  cache_examples=true_for_shared_ui
111
  )
112
 
113
- demo.queue(max_size=15)
114
- demo.launch(share=True)
 
29
  if(is_spaces):
30
  true_for_shared_ui = True if "zcxu-eric/magicanimate" in os.environ['SPACE_ID'] else False
31
 
32
+
33
  animator = MagicAnimate()
34
 
35
  def animate(reference_image, motion_sequence_state, seed=1, steps=25, guidance_scale=7.5):
 
54
  </div>
55
  """)
56
  animation = gr.Video(format="mp4", label="Animation Results", autoplay=True)
57
+
58
  with gr.Row():
59
  reference_image = gr.Image(label="Reference Image")
60
  motion_sequence = gr.Video(format="mp4", label="Motion Sequence",max_length=5)
61
+
62
  with gr.Column():
63
  random_seed = gr.Textbox(label="Random seed", value=1, info="default: -1")
64
  sampling_steps = gr.Textbox(label="Sampling steps", value=25, info="default: 25")
 
69
  reader = imageio.get_reader(video)
70
  fps = reader.get_meta_data()['fps']
71
  return video
72
+
73
  def read_image(image, size=512):
74
  return np.array(Image.fromarray(image).resize((size, size)))
75
+
76
  # when user uploads a new video
77
  motion_sequence.upload(
78
  read_video,
 
90
  # when the `submit` button is clicked
91
  submit.click(
92
  animate,
93
+ [reference_image, motion_sequence, random_seed, sampling_steps, guidance_scale],
94
  animation
95
  )
96
 
 
110
  cache_examples=true_for_shared_ui
111
  )
112
 
113
+ demo.queue(max_size=15, api_open=False)
114
+ demo.launch(share=True, show_api=False)