asahi417 commited on
Commit
5177dcf
1 Parent(s): bf9d629

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. app.py +7 -10
app.py CHANGED
@@ -19,11 +19,12 @@ title = ("# [Stable Video Diffusion](ttps://huggingface.co/stabilityai/stable-vi
19
 
20
 
21
  @spaces.GPU(duration=120)
22
- def infer(init_image, motion_bucket_id, noise_aug_strength, decode_chunk_size, fps, seed):
23
  base_count = len(glob(os.path.join(tmp_output_dir, "*.mp4")))
24
  video_path = os.path.join(tmp_output_dir, f"{base_count:06d}.mp4")
25
  frames = model.image2video(
26
  [init_image],
 
27
  motion_bucket_id=motion_bucket_id,
28
  noise_aug_strength=noise_aug_strength,
29
  decode_chunk_size=decode_chunk_size,
@@ -43,19 +44,15 @@ with gr.Blocks() as demo:
43
  video = gr.Video()
44
  with gr.Accordion("Advanced options", open=False):
45
  seed = gr.Slider(label="Seed", minimum=0, maximum=1_000_000, step=1, value=0)
 
46
  motion_bucket_id = gr.Slider(label="Motion bucket id", minimum=1, maximum=255, step=1, value=127)
47
- noise_aug_strength = gr.Slider(label="Noise Strength", minimum=0, maximum=1, step=0.01, value=0.02)
48
  fps = gr.Slider(label="Frames per second", minimum=5, maximum=30, step=1, value=6)
49
- decode_chunk_size = gr.Slider(label="Frames per second", minimum=1, maximum=10, step=1, value=2)
50
  run_button.click(
51
  fn=infer,
52
- inputs=[image, motion_bucket_id, noise_aug_strength, decode_chunk_size, fps, seed],
53
- outputs=[video]
54
- )
55
- gr.Examples(
56
- fn=infer,
57
- examples=examples,
58
- inputs=image,
59
  outputs=[video]
60
  )
 
61
  demo.launch()
 
19
 
20
 
21
  @spaces.GPU(duration=120)
22
+ def infer(init_image, num_frames, motion_bucket_id, noise_aug_strength, decode_chunk_size, fps, seed):
23
  base_count = len(glob(os.path.join(tmp_output_dir, "*.mp4")))
24
  video_path = os.path.join(tmp_output_dir, f"{base_count:06d}.mp4")
25
  frames = model.image2video(
26
  [init_image],
27
+ num_frames=num_frames,
28
  motion_bucket_id=motion_bucket_id,
29
  noise_aug_strength=noise_aug_strength,
30
  decode_chunk_size=decode_chunk_size,
 
44
  video = gr.Video()
45
  with gr.Accordion("Advanced options", open=False):
46
  seed = gr.Slider(label="Seed", minimum=0, maximum=1_000_000, step=1, value=0)
47
+ num_frames = gr.Slider(label="Number of frames", minimum=1, maximum=100, step=1, value=25)
48
  motion_bucket_id = gr.Slider(label="Motion bucket id", minimum=1, maximum=255, step=1, value=127)
49
+ noise_aug_strength = gr.Slider(label="Noise strength", minimum=0, maximum=1, step=0.01, value=0.02)
50
  fps = gr.Slider(label="Frames per second", minimum=5, maximum=30, step=1, value=6)
51
+ decode_chunk_size = gr.Slider(label="Decode chunk size", minimum=1, maximum=10, step=1, value=2)
52
  run_button.click(
53
  fn=infer,
54
+ inputs=[image, num_frames, motion_bucket_id, noise_aug_strength, decode_chunk_size, fps, seed],
 
 
 
 
 
 
55
  outputs=[video]
56
  )
57
+ gr.Examples(fn=infer, examples=examples, inputs=image, outputs=[video])
58
  demo.launch()