Spaces:
Paused
Paused
Commit
•
e276a90
1
Parent(s):
992a99c
Also return the frames as images (#8)
Browse files- Also return the frames as images (4764ded05b15440d0b438d387e412bf9cd885914)
Co-authored-by: Fabrice TIERCELIN <Fabrice-TIERCELIN@users.noreply.huggingface.co>
app.py
CHANGED
@@ -53,7 +53,7 @@ def sample(
|
|
53 |
export_to_video(frames, video_path, fps=fps_id)
|
54 |
torch.manual_seed(seed)
|
55 |
|
56 |
-
return video_path, seed
|
57 |
|
58 |
def resize_image(image, output_size=(1024, 576)):
|
59 |
# Calculate aspect ratios
|
@@ -91,18 +91,20 @@ with gr.Blocks() as demo:
|
|
91 |
#### Research release ([_non-commercial_](https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt/blob/main/LICENSE)): generate `4s` vid from a single image at (`25 frames` at `6 fps`). this demo uses [🧨 diffusers for low VRAM and fast generation](https://huggingface.co/docs/diffusers/main/en/using-diffusers/svd).
|
92 |
''')
|
93 |
with gr.Row():
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
|
|
|
|
103 |
|
104 |
image.upload(fn=resize_image, inputs=image, outputs=image, queue=False)
|
105 |
-
generate_btn.click(fn=sample, inputs=[image, seed, randomize_seed, motion_bucket_id, fps_id], outputs=[video, seed], api_name="video")
|
106 |
|
107 |
if __name__ == "__main__":
|
108 |
#demo.queue(max_size=20, api_open=False)
|
|
|
53 |
export_to_video(frames, video_path, fps=fps_id)
|
54 |
torch.manual_seed(seed)
|
55 |
|
56 |
+
return video_path, frames, seed
|
57 |
|
58 |
def resize_image(image, output_size=(1024, 576)):
|
59 |
# Calculate aspect ratios
|
|
|
91 |
#### Research release ([_non-commercial_](https://huggingface.co/stabilityai/stable-video-diffusion-img2vid-xt/blob/main/LICENSE)): generate `4s` vid from a single image at (`25 frames` at `6 fps`). this demo uses [🧨 diffusers for low VRAM and fast generation](https://huggingface.co/docs/diffusers/main/en/using-diffusers/svd).
|
92 |
''')
|
93 |
with gr.Row():
|
94 |
+
with gr.Column():
|
95 |
+
image = gr.Image(label="Upload your image", type="pil")
|
96 |
+
with gr.Accordion("Advanced options", open=False):
|
97 |
+
seed = gr.Slider(label="Seed", value=42, randomize=True, minimum=0, maximum=max_64_bit_int, step=1)
|
98 |
+
randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
99 |
+
motion_bucket_id = gr.Slider(label="Motion bucket id", info="Controls how much motion to add/remove from the image", value=127, minimum=1, maximum=255)
|
100 |
+
fps_id = gr.Slider(label="Frames per second", info="The length of your video in seconds will be 25/fps", value=6, minimum=5, maximum=30)
|
101 |
+
generate_btn = gr.Button(value="Animate", variant="primary")
|
102 |
+
with gr.Column():
|
103 |
+
video = gr.Video(label="Generated video")
|
104 |
+
gallery = gr.Gallery(label="Generated frames")
|
105 |
|
106 |
image.upload(fn=resize_image, inputs=image, outputs=image, queue=False)
|
107 |
+
generate_btn.click(fn=sample, inputs=[image, seed, randomize_seed, motion_bucket_id, fps_id], outputs=[video, gallery, seed], api_name="video")
|
108 |
|
109 |
if __name__ == "__main__":
|
110 |
#demo.queue(max_size=20, api_open=False)
|