test
Browse files
app.py
CHANGED
|
@@ -299,6 +299,32 @@ def generate_video(
|
|
| 299 |
return video_path, video_path, current_seed
|
| 300 |
|
| 301 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 302 |
with gr.Blocks() as demo:
|
| 303 |
gr.Markdown("# WAMU - Wan 2.2 I2V (14B)")
|
| 304 |
gr.Markdown("## ℹ️ **A Note on Performance:** This version prioritizes a straightforward setup over maximum speed, so performance may vary.")
|
|
@@ -326,18 +352,27 @@ with gr.Blocks() as demo:
|
|
| 326 |
)
|
| 327 |
flow_shift_slider = gr.Slider(minimum=0.5, maximum=15.0, step=0.1, value=3.0, label="Flow Shift")
|
| 328 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 329 |
generate_button = gr.Button("Generate Video", variant="primary")
|
| 330 |
with gr.Column():
|
| 331 |
video_output = gr.Video(label="Generated Video", autoplay=True, interactive=False)
|
| 332 |
file_output = gr.File(label="Download Video")
|
| 333 |
|
|
|
|
|
|
|
|
|
|
| 334 |
ui_inputs = [
|
| 335 |
input_image_component, last_image_component, prompt_input, steps_slider,
|
| 336 |
negative_prompt_input, duration_seconds_input,
|
| 337 |
guidance_scale_input, guidance_scale_2_input, seed_input, randomize_seed_checkbox,
|
| 338 |
quality_slider, scheduler_dropdown, flow_shift_slider,
|
| 339 |
]
|
| 340 |
-
generate_button.click(fn=generate_video, inputs=ui_inputs, outputs=[video_output, file_output, seed_input])
|
|
|
|
| 341 |
|
| 342 |
|
| 343 |
if __name__ == "__main__":
|
|
|
|
| 299 |
return video_path, video_path, current_seed
|
| 300 |
|
| 301 |
|
| 302 |
+
def visibility_interpolation():
|
| 303 |
+
return (
|
| 304 |
+
gr.update(visible=True),
|
| 305 |
+
gr.update(visible=True)
|
| 306 |
+
)
|
| 307 |
+
|
| 308 |
+
|
| 309 |
+
def interpolate_video(generated_video, multiplier, request: gr.Request):
|
| 310 |
+
x_ip_token = request.headers['x-ip-token']
|
| 311 |
+
client = Client("r3gm/FPS_Enhancer", headers={"x-ip-token": x_ip_token})
|
| 312 |
+
result = client.predict(
|
| 313 |
+
input_video=handle_file(generated_video),
|
| 314 |
+
frame_multiplier="2",
|
| 315 |
+
time_exponent=1,
|
| 316 |
+
fixed_fps=0,
|
| 317 |
+
video_scale="1",
|
| 318 |
+
remove_duplicate_frames=False,
|
| 319 |
+
create_montage=False,
|
| 320 |
+
api_name="/run_rife"
|
| 321 |
+
)
|
| 322 |
+
return result[0]["filepath"]
|
| 323 |
+
|
| 324 |
+
|
| 325 |
+
def generate_interpolate(generated_video, multiplier, request: gr.Request):
|
| 326 |
+
return interpolate_video(generated_video, multiplier, request)
|
| 327 |
+
|
| 328 |
with gr.Blocks() as demo:
|
| 329 |
gr.Markdown("# WAMU - Wan 2.2 I2V (14B)")
|
| 330 |
gr.Markdown("## ℹ️ **A Note on Performance:** This version prioritizes a straightforward setup over maximum speed, so performance may vary.")
|
|
|
|
| 352 |
)
|
| 353 |
flow_shift_slider = gr.Slider(minimum=0.5, maximum=15.0, step=0.1, value=3.0, label="Flow Shift")
|
| 354 |
|
| 355 |
+
frame_multi = gr.Number(
|
| 356 |
+
minimum=2, maximum=6, step=1, value=2, label="Frame Multiplier for 'Interpolate video'",
|
| 357 |
+
info="2X = Double FPS (e.g. 16 -> 32). Higher multipliers create more intermediate frames."
|
| 358 |
+
)
|
| 359 |
+
|
| 360 |
generate_button = gr.Button("Generate Video", variant="primary")
|
| 361 |
with gr.Column():
|
| 362 |
video_output = gr.Video(label="Generated Video", autoplay=True, interactive=False)
|
| 363 |
file_output = gr.File(label="Download Video")
|
| 364 |
|
| 365 |
+
frame_button = gr.Button("Interpolate video", variant="secondary", visible=False)
|
| 366 |
+
frame_output = gr.File(label="Interpolated video", visible=False)
|
| 367 |
+
|
| 368 |
ui_inputs = [
|
| 369 |
input_image_component, last_image_component, prompt_input, steps_slider,
|
| 370 |
negative_prompt_input, duration_seconds_input,
|
| 371 |
guidance_scale_input, guidance_scale_2_input, seed_input, randomize_seed_checkbox,
|
| 372 |
quality_slider, scheduler_dropdown, flow_shift_slider,
|
| 373 |
]
|
| 374 |
+
generate_button.click(fn=generate_video, inputs=ui_inputs, outputs=[video_output, file_output, seed_input]).success(visibility_interpolation, [], [frame_button, frame_output])
|
| 375 |
+
frame_button.click(fn=generate_interpolate, inputs=[file_output, frame_multi], outputs=[frame_output])
|
| 376 |
|
| 377 |
|
| 378 |
if __name__ == "__main__":
|