Update app.py
Browse files
app.py
CHANGED
|
@@ -107,8 +107,6 @@ def generate_video(input_image, motion_prompt, num_frames, guidance, seed, rando
|
|
| 107 |
new_w, new_h = 480, 832
|
| 108 |
img = img.resize((new_w, new_h), Image.LANCZOS)
|
| 109 |
|
| 110 |
-
pipe.to("cuda")
|
| 111 |
-
|
| 112 |
generator = torch.Generator(device="cpu").manual_seed(seed)
|
| 113 |
|
| 114 |
output = pipe(
|
|
@@ -125,8 +123,6 @@ def generate_video(input_image, motion_prompt, num_frames, guidance, seed, rando
|
|
| 125 |
|
| 126 |
frames = output.frames[0]
|
| 127 |
|
| 128 |
-
pipe.to("cpu")
|
| 129 |
-
|
| 130 |
tmp = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False)
|
| 131 |
export_to_video(frames, tmp.name, fps=16)
|
| 132 |
|
|
@@ -339,7 +335,6 @@ with gr.Blocks(css=css, title="VideoGen") as demo:
|
|
| 339 |
</div>
|
| 340 |
""")
|
| 341 |
|
| 342 |
-
# Input image
|
| 343 |
input_image = gr.Image(
|
| 344 |
label="Input Image",
|
| 345 |
type="numpy",
|
|
@@ -347,7 +342,6 @@ with gr.Blocks(css=css, title="VideoGen") as demo:
|
|
| 347 |
elem_classes="upload-area",
|
| 348 |
)
|
| 349 |
|
| 350 |
-
# Motion prompt
|
| 351 |
gr.HTML('<div class="card"><div class="card-label">✦ Motion — what should move?</div>')
|
| 352 |
motion_prompt = gr.Textbox(
|
| 353 |
show_label=False,
|
|
@@ -356,13 +350,11 @@ with gr.Blocks(css=css, title="VideoGen") as demo:
|
|
| 356 |
)
|
| 357 |
gr.HTML('</div>')
|
| 358 |
|
| 359 |
-
# Generate
|
| 360 |
generate_btn = gr.Button(
|
| 361 |
"Generate Video ✦", variant="primary",
|
| 362 |
size="lg", elem_classes="gen-btn",
|
| 363 |
)
|
| 364 |
|
| 365 |
-
# Output
|
| 366 |
output_video = gr.Video(
|
| 367 |
label="Generated Video",
|
| 368 |
elem_classes="video-out",
|
|
@@ -379,7 +371,6 @@ with gr.Blocks(css=css, title="VideoGen") as demo:
|
|
| 379 |
elem_classes="hint-box",
|
| 380 |
)
|
| 381 |
|
| 382 |
-
# Settings
|
| 383 |
with gr.Accordion("⚙️ Settings", open=False):
|
| 384 |
gr.HTML('<div style="height:6px"></div>')
|
| 385 |
|
|
|
|
| 107 |
new_w, new_h = 480, 832
|
| 108 |
img = img.resize((new_w, new_h), Image.LANCZOS)
|
| 109 |
|
|
|
|
|
|
|
| 110 |
generator = torch.Generator(device="cpu").manual_seed(seed)
|
| 111 |
|
| 112 |
output = pipe(
|
|
|
|
| 123 |
|
| 124 |
frames = output.frames[0]
|
| 125 |
|
|
|
|
|
|
|
| 126 |
tmp = tempfile.NamedTemporaryFile(suffix=".mp4", delete=False)
|
| 127 |
export_to_video(frames, tmp.name, fps=16)
|
| 128 |
|
|
|
|
| 335 |
</div>
|
| 336 |
""")
|
| 337 |
|
|
|
|
| 338 |
input_image = gr.Image(
|
| 339 |
label="Input Image",
|
| 340 |
type="numpy",
|
|
|
|
| 342 |
elem_classes="upload-area",
|
| 343 |
)
|
| 344 |
|
|
|
|
| 345 |
gr.HTML('<div class="card"><div class="card-label">✦ Motion — what should move?</div>')
|
| 346 |
motion_prompt = gr.Textbox(
|
| 347 |
show_label=False,
|
|
|
|
| 350 |
)
|
| 351 |
gr.HTML('</div>')
|
| 352 |
|
|
|
|
| 353 |
generate_btn = gr.Button(
|
| 354 |
"Generate Video ✦", variant="primary",
|
| 355 |
size="lg", elem_classes="gen-btn",
|
| 356 |
)
|
| 357 |
|
|
|
|
| 358 |
output_video = gr.Video(
|
| 359 |
label="Generated Video",
|
| 360 |
elem_classes="video-out",
|
|
|
|
| 371 |
elem_classes="hint-box",
|
| 372 |
)
|
| 373 |
|
|
|
|
| 374 |
with gr.Accordion("⚙️ Settings", open=False):
|
| 375 |
gr.HTML('<div style="height:6px"></div>')
|
| 376 |
|