Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -39,14 +39,14 @@ max_64_bit_int = 2**63 - 1
|
|
39 |
|
40 |
@spaces.GPU(duration=120)
|
41 |
def sample(
|
42 |
-
image: Image,
|
43 |
seed: Optional[int] = 42,
|
44 |
-
randomize_seed: bool = True,
|
45 |
-
motion_bucket_id: int = 127,
|
46 |
-
fps_id: int = 6,
|
47 |
-
version: str = "svd_xt",
|
48 |
-
cond_aug: float = 0.02,
|
49 |
-
decoding_t: int = 3, # Number of frames decoded at a time! This eats most VRAM. Reduce if necessary.
|
50 |
device: str = "cuda",
|
51 |
output_folder: str = "outputs",
|
52 |
progress=gr.Progress(track_tqdm=True)
|
@@ -77,7 +77,7 @@ def sample(
|
|
77 |
|
78 |
return video_path, seed
|
79 |
|
80 |
-
def resize_image(image, output_size=(
|
81 |
# Calculate aspect ratios
|
82 |
target_aspect = output_size[0] / output_size[1] # Aspect ratio of the desired size
|
83 |
image_aspect = image.width / image.height # Aspect ratio of the original image
|
@@ -114,34 +114,34 @@ with gr.Blocks() as demo:
|
|
114 |
''')
|
115 |
with gr.Row():
|
116 |
with gr.Column():
|
117 |
-
|
118 |
generate_btn = gr.Button("Generate")
|
119 |
video = gr.Video()
|
120 |
-
with gr.Accordion("Advanced options", open=False):
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
image.upload(fn=resize_image, inputs=image, outputs=image, queue=False)
|
127 |
-
generate_btn.click(fn=sample, inputs=[
|
128 |
-
gr.Examples(
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
)
|
145 |
|
146 |
if __name__ == "__main__":
|
147 |
#demo.queue(max_size=20, api_open=False)
|
|
|
39 |
|
40 |
@spaces.GPU(duration=120)
|
41 |
def sample(
|
42 |
+
# image: Image,
|
43 |
seed: Optional[int] = 42,
|
44 |
+
# randomize_seed: bool = True,
|
45 |
+
# motion_bucket_id: int = 127,
|
46 |
+
# fps_id: int = 6,
|
47 |
+
# version: str = "svd_xt",
|
48 |
+
# cond_aug: float = 0.02,
|
49 |
+
# decoding_t: int = 3, # Number of frames decoded at a time! This eats most VRAM. Reduce if necessary.
|
50 |
device: str = "cuda",
|
51 |
output_folder: str = "outputs",
|
52 |
progress=gr.Progress(track_tqdm=True)
|
|
|
77 |
|
78 |
return video_path, seed
|
79 |
|
80 |
+
def resize_image(image, output_size=(672, 384)):
|
81 |
# Calculate aspect ratios
|
82 |
target_aspect = output_size[0] / output_size[1] # Aspect ratio of the desired size
|
83 |
image_aspect = image.width / image.height # Aspect ratio of the original image
|
|
|
114 |
''')
|
115 |
with gr.Row():
|
116 |
with gr.Column():
|
117 |
+
# image = gr.Image(label="Upload your image", type="pil")
|
118 |
generate_btn = gr.Button("Generate")
|
119 |
video = gr.Video()
|
120 |
+
# with gr.Accordion("Advanced options", open=False):
|
121 |
+
# seed = gr.Slider(label="Seed", value=42, randomize=True, minimum=0, maximum=max_64_bit_int, step=1)
|
122 |
+
# randomize_seed = gr.Checkbox(label="Randomize seed", value=True)
|
123 |
+
# 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)
|
124 |
+
# 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)
|
125 |
+
|
126 |
+
# image.upload(fn=resize_image, inputs=image, outputs=image, queue=False)
|
127 |
+
generate_btn.click(fn=sample, inputs=[seed], outputs=[video, seed], api_name="video")
|
128 |
+
# gr.Examples(
|
129 |
+
# examples=[
|
130 |
+
# "images/blink_meme.png",
|
131 |
+
# "images/confused2_meme.png",
|
132 |
+
# "images/disaster_meme.png",
|
133 |
+
# "images/distracted_meme.png",
|
134 |
+
# "images/hide_meme.png",
|
135 |
+
# "images/nazare_meme.png",
|
136 |
+
# "images/success_meme.png",
|
137 |
+
# "images/willy_meme.png",
|
138 |
+
# "images/wink_meme.png"
|
139 |
+
# ],
|
140 |
+
# inputs=image,
|
141 |
+
# outputs=[video, seed],
|
142 |
+
# fn=sample,
|
143 |
+
# cache_examples="lazy",
|
144 |
+
# )
|
145 |
|
146 |
if __name__ == "__main__":
|
147 |
#demo.queue(max_size=20, api_open=False)
|