MCPcopy Create free account
hub / github.com/OpenImagingLab/FlashVSR / on_ui_tabs

Function on_ui_tabs

diffsynth/extensions/FastBlend/api.py:257–397  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

255
256
257def on_ui_tabs():
258 with gr.Blocks(analytics_enabled=False) as ui_component:
259 with gr.Tab("Blend"):
260 gr.Markdown("""
261# Blend
262
263Given a guide video and a style video, this algorithm will make the style video fluent according to the motion features of the guide video. Click [here](https://github.com/Artiprocher/sd-webui-fastblend/assets/35051019/208d902d-6aba-48d7-b7d5-cd120ebd306d) to see the example. Note that this extension doesn't support long videos. Please use short videos (e.g., several seconds). The algorithm is mainly designed for 512*512 resolution. Please use a larger `Minimum patch size` for higher resolution.
264 """)
265 with gr.Row():
266 with gr.Column():
267 with gr.Tab("Guide video"):
268 video_guide = gr.Video(label="Guide video")
269 with gr.Tab("Guide video (images format)"):
270 video_guide_folder = gr.Textbox(label="Guide video (images format)", value="")
271 with gr.Column():
272 with gr.Tab("Style video"):
273 video_style = gr.Video(label="Style video")
274 with gr.Tab("Style video (images format)"):
275 video_style_folder = gr.Textbox(label="Style video (images format)", value="")
276 with gr.Column():
277 output_path = gr.Textbox(label="Output directory", value="", placeholder="Leave empty to use the directory of style video")
278 fps = gr.Textbox(label="Fps", value="", placeholder="Leave empty to use the default fps")
279 video_output = gr.Video(label="Output video", interactive=False, show_share_button=True)
280 btn = gr.Button(value="Blend")
281 with gr.Row():
282 with gr.Column():
283 gr.Markdown("# Settings")
284 mode = gr.Radio(["Fast", "Balanced", "Accurate"], label="Inference mode", value="Fast", interactive=True)
285 window_size = gr.Slider(label="Sliding window size", value=15, minimum=1, maximum=1000, step=1, interactive=True)
286 batch_size = gr.Slider(label="Batch size", value=8, minimum=1, maximum=128, step=1, interactive=True)
287 tracking_window_size = gr.Slider(label="Tracking window size (only for accurate mode)", value=0, minimum=0, maximum=10, step=1, interactive=True)
288 gr.Markdown("## Advanced Settings")
289 minimum_patch_size = gr.Slider(label="Minimum patch size (odd number)", value=5, minimum=5, maximum=99, step=2, interactive=True)
290 num_iter = gr.Slider(label="Number of iterations", value=5, minimum=1, maximum=10, step=1, interactive=True)
291 guide_weight = gr.Slider(label="Guide weight", value=10.0, minimum=0.0, maximum=100.0, step=0.1, interactive=True)
292 initialize = gr.Radio(["identity", "random"], label="NNF initialization", value="identity", interactive=True)
293 with gr.Column():
294 gr.Markdown("""
295# Reference
296
297* Output directory: the directory to save the video.
298* Inference mode
299
300|Mode|Time|Memory|Quality|Frame by frame output|Description|
301|-|-|-|-|-|-|
302|Fast|■|■■■|■■|No|Blend the frames using a tree-like data structure, which requires much RAM but is fast.|
303|Balanced|■■|■|■■|Yes|Blend the frames naively.|
304|Accurate|■■■|■|■■■|Yes|Blend the frames and align them together for higher video quality. When [batch size] >= [sliding window size] * 2 + 1, the performance is the best.|
305
306* Sliding window size: our algorithm will blend the frames in a sliding windows. If the size is n, each frame will be blended with the last n frames and the next n frames. A large sliding window can make the video fluent but sometimes smoggy.
307* Batch size: a larger batch size makes the program faster but requires more VRAM.
308* Tracking window size (only for accurate mode): The size of window in which our algorithm tracks moving objects. Empirically, 1 is enough.
309* Advanced settings
310 * Minimum patch size (odd number): the minimum patch size used for patch matching. (Default: 5)
311 * Number of iterations: the number of iterations of patch matching. (Default: 5)
312 * Guide weight: a parameter that determines how much motion feature applied to the style video. (Default: 10)
313 * NNF initialization: how to initialize the NNF (Nearest Neighbor Field). (Default: identity)
314 """)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected