vinesmsuic
commited on
Commit
•
16fe5e4
1
Parent(s):
a67618a
bye pinky
Browse files
app.py
CHANGED
@@ -310,79 +310,76 @@ def btn_infer_fn(video_path,
|
|
310 |
|
311 |
# Create the UI
|
312 |
#=====================================
|
313 |
-
with gr.Blocks(
|
314 |
gr.Markdown("# <img src='https://tiger-ai-lab.github.io/AnyV2V/static/images/icon.png' width='30'/> AnyV2V")
|
315 |
gr.Markdown("Official 🤗 Gradio demo for [AnyV2V: A Plug-and-Play Framework For Any Video-to-Video Editing Tasks](https://tiger-ai-lab.github.io/AnyV2V/)")
|
316 |
|
317 |
|
318 |
with gr.Tabs():
|
319 |
with gr.TabItem('AnyV2V + InstructPix2Pix'):
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
with gr.
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
with
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
gr.
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
with
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
with gr.
|
362 |
-
gr.
|
363 |
-
|
364 |
-
|
365 |
-
with
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
av_guidance_scale = gr.Number(label="Guidance Scale", value=9, minimum=0)
|
384 |
-
av_seed = gr.Number(label="Seed (-1 means random)", value=42, minimum=-1, maximum=sys.maxsize)
|
385 |
-
av_neg_prompt = gr.Textbox(label="Negative Prompt", value="Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms")
|
386 |
|
387 |
examples = gr.Examples(examples=demo_examples,
|
388 |
label="Examples (Just click on Video Editing button after loading them into the UI)",
|
|
|
310 |
|
311 |
# Create the UI
|
312 |
#=====================================
|
313 |
+
with gr.Blocks() as demo:
|
314 |
gr.Markdown("# <img src='https://tiger-ai-lab.github.io/AnyV2V/static/images/icon.png' width='30'/> AnyV2V")
|
315 |
gr.Markdown("Official 🤗 Gradio demo for [AnyV2V: A Plug-and-Play Framework For Any Video-to-Video Editing Tasks](https://tiger-ai-lab.github.io/AnyV2V/)")
|
316 |
|
317 |
|
318 |
with gr.Tabs():
|
319 |
with gr.TabItem('AnyV2V + InstructPix2Pix'):
|
320 |
+
gr.Markdown("# Preprocessing Video Stage")
|
321 |
+
gr.Markdown("AnyV2V only support video with 2 seconds duration and 8 fps. If your video is not in this format, we will preprocess it for you. Click on the Preprocess video button!")
|
322 |
+
with gr.Row():
|
323 |
+
with gr.Column():
|
324 |
+
video_raw = gr.Video(label="Raw Video Input")
|
325 |
+
btn_pv = gr.Button("Preprocess Video")
|
326 |
+
|
327 |
+
with gr.Column():
|
328 |
+
video_input = gr.Video(label="Preprocessed Video Input", interactive=False)
|
329 |
+
with gr.Column():
|
330 |
+
advanced_settings_pv = gr.Accordion("Advanced Settings for Video Preprocessing", open=False)
|
331 |
+
with advanced_settings_pv:
|
332 |
+
with gr.Column():
|
333 |
+
pv_width = gr.Number(label="Width", value=512, minimum=1, maximum=4096)
|
334 |
+
pv_height = gr.Number(label="Height", value=512, minimum=1, maximum=4096)
|
335 |
+
pv_start_time = gr.Number(label="Start Time (End time - Start time must be = 2)", value=0, minimum=0)
|
336 |
+
pv_end_time = gr.Number(label="End Time (End time - Start time must be = 2)", value=2, minimum=0)
|
337 |
+
pv_center_crop = gr.Checkbox(label="Center Crop", value=True)
|
338 |
+
pv_x_offset = gr.Number(label="Horizontal Offset (-1 to 1)", value=0, minimum=-1, maximum=1)
|
339 |
+
pv_y_offset = gr.Number(label="Vertical Offset (-1 to 1)", value=0, minimum=-1, maximum=1)
|
340 |
+
pv_longest_to_width = gr.Checkbox(label="Resize Longest Dimension to Width")
|
341 |
+
|
342 |
+
gr.Markdown("# Image Editing Stage")
|
343 |
+
gr.Markdown("Edit the first frame of the video to your liking! Click on the Edit the first frame button after inputting the editing instruction prompt.")
|
344 |
+
with gr.Row():
|
345 |
+
with gr.Column():
|
346 |
+
src_first_frame = gr.Image(label="First Frame", type="filepath", interactive=False)
|
347 |
+
image_instruct_prompt = gr.Textbox(label="Editing instruction prompt")
|
348 |
+
btn_image_edit = gr.Button("Edit the first frame")
|
349 |
+
with gr.Column():
|
350 |
+
image_input_output = gr.Image(label="Edited Frame", type="filepath")
|
351 |
+
with gr.Column():
|
352 |
+
advanced_settings_image_edit = gr.Accordion("Advanced Settings for Image Editing", open=True)
|
353 |
+
with advanced_settings_image_edit:
|
354 |
+
with gr.Column():
|
355 |
+
ie_neg_prompt = gr.Textbox(label="Negative Prompt", value="low res, blurry, watermark, jpeg artifacts")
|
356 |
+
ie_seed = gr.Number(label="Seed (-1 means random)", value=-1, minimum=-1, maximum=sys.maxsize)
|
357 |
+
ie_force_512 = gr.Checkbox(label="Force resize to 512x512 before feeding into the image editing model")
|
358 |
+
|
359 |
+
gr.Markdown("# Video Editing Stage")
|
360 |
+
gr.Markdown("Enjoy the full control of the video editing process using the edited image and the preprocessed video! Click on the Run AnyV2V button after inputting the video description prompt. Try tweak with the setting if the output does not satisfy you!")
|
361 |
+
with gr.Row():
|
362 |
+
with gr.Column():
|
363 |
+
video_prompt = gr.Textbox(label="Video description prompt")
|
364 |
+
settings_anyv2v = gr.Accordion("Settings for AnyV2V")
|
365 |
+
with settings_anyv2v:
|
366 |
+
with gr.Column():
|
367 |
+
av_pnp_f_t = gr.Slider(minimum=0, maximum=1, step=0.01, value=0.2, label="Convolutional injection (pnp_f_t)")
|
368 |
+
av_pnp_spatial_attn_t = gr.Slider(minimum=0, maximum=1, step=0.01, value=0.2, label="Spatial Attention injection (pnp_spatial_attn_t)")
|
369 |
+
av_pnp_temp_attn_t = gr.Slider(minimum=0, maximum=1, step=0.01, value=0.5, label="Temporal Attention injection (pnp_temp_attn_t)")
|
370 |
+
btn_infer = gr.Button("Run Video Editing")
|
371 |
+
with gr.Column():
|
372 |
+
video_output = gr.Video(label="Video Output")
|
373 |
+
with gr.Column():
|
374 |
+
advanced_settings_anyv2v = gr.Accordion("Advanced Settings for AnyV2V", open=False)
|
375 |
+
with advanced_settings_anyv2v:
|
376 |
+
with gr.Column():
|
377 |
+
av_ddim_init_latents_t_idx = gr.Number(label="DDIM Initial Latents t Index", value=0, minimum=0)
|
378 |
+
av_ddim_inversion_steps = gr.Number(label="DDIM Inversion Steps", value=100, minimum=1)
|
379 |
+
av_num_inference_steps = gr.Number(label="Number of Inference Steps", value=50, minimum=1)
|
380 |
+
av_guidance_scale = gr.Number(label="Guidance Scale", value=9, minimum=0)
|
381 |
+
av_seed = gr.Number(label="Seed (-1 means random)", value=42, minimum=-1, maximum=sys.maxsize)
|
382 |
+
av_neg_prompt = gr.Textbox(label="Negative Prompt", value="Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms")
|
|
|
|
|
|
|
383 |
|
384 |
examples = gr.Examples(examples=demo_examples,
|
385 |
label="Examples (Just click on Video Editing button after loading them into the UI)",
|