Skip to content
Python

merged

DeepBeepMeep65b3c3e7e409
diff --cc wgp.py
index ce2d2b8,9f87dce..1a3286e
--- a/wgp.py
+++ b/wgp.py
@@@ -2907,102 -2776,10 +2907,110 @@@ def select_video(state, input_file_list
if data!=None:
choice = data.get("index",0)
- file_list = gen.get("file_list", [])
- gen["last_selected"] = (choice + 1) >= len(file_list)
- gen["selected"] = choice
- return
+ set_file_choice(gen, file_list, choice)
+
+ if len(file_list) > 0:
+ configs = file_settings_list[choice]
+ from wan.utils.utils import get_video_info, get_file_creation_date
+ file_name = file_list[choice]
+ fps, width, height, frames_count = get_video_info(file_name)
+ video_model_name = configs.get("type", "Unknown model")
+ if "-" in video_model_name: video_model_name = video_model_name[video_model_name.find("-")+2:]
+ video_prompt = configs.get("prompt", "")[:200]
+ video_video_prompt_type = configs.get("video_prompt_type", "")
+ video_image_prompt_type = configs.get("image_prompt_type", "")
+ map_video_prompt = {"V" : "Control Video", "A" : "Mask Video", "I" : "Reference Images"}
+ map_image_prompt = {"V" : "Source Video", "L" : "Last Video", "S" : "Start Image", "E" : "End Image"}
+ video_other_prompts = [ v for s,v in map_image_prompt.items() if s in video_image_prompt_type] + [ v for s,v in map_video_prompt.items() if s in video_video_prompt_type]
+ video_model_type = configs.get("model_type", "t2v")
+ if any_audio_track(video_model_type): video_other_prompts += ["Audio Source"]
+ video_other_prompts = ", ".join(video_other_prompts)
+ video_resolution = configs.get("resolution", "") + f" (real: {width}x{height})"
+ video_length = configs.get("video_length", 0)
+ original_fps= int(video_length/frames_count*fps)
+ video_length_summary = f"{video_length} frames"
+ video_window_no = configs.get("window_no", 0)
+ if video_window_no > 0: video_length_summary +=f", Window no {video_window_no }"
+ video_length_summary += " ("
+ if video_length != frames_count: video_length_summary += f"real: {frames_count} frames, "
+ video_length_summary += f"{frames_count/fps:.1f}s, {round(fps)} fps)"
+ video_seed = configs.get("seed", -1)
+ video_MMAudio_seed = configs.get("MMAudio_seed", video_seed)
+ video_guidance_scale = configs.get("video_guidance_scale", 1)
+ video_embedded_guidance_scale = configs.get("video_embedded_guidance_scale ", 1)
+ if get_model_family(video_model_type) == "hunyuan":
+ video_guidance_scale = video_embedded_guidance_scale
+ video_guidance_label = "Embedded Guidance Scale"
+ else:
+ video_guidance_label = "Guidance Scale"
+ video_flow_shift = configs.get("flow_shift", 1)
++ video_video_guide_outpainting = configs.get("video_guide_outpainting", "")
++ video_outpainting = ""
++ if len(video_video_guide_outpainting) > 0 and not video_video_guide_outpainting.startswith("#"):
++ video_video_guide_outpainting = video_video_guide_outpainting.split(" ")
++ video_outpainting = f"Top={video_video_guide_outpainting[0]}%, Bottom={video_video_guide_outpainting[1]}%, Left={video_video_guide_outpainting[2]}%, Right={video_video_guide_outpainting[3]}%"
+ video_num_inference_steps = configs.get("num_inference_steps", 0)
+ video_creation_date = str(get_file_creation_date(file_name))
+ if "." in video_creation_date: video_creation_date = video_creation_date[:video_creation_date.rfind(".")]
+ video_generation_time = str(configs.get("generation_time", "0")) + "s"
+ video_activated_loras = "<BR>".join(configs.get("activated_loras", []))
+ video_temporal_upsampling = configs.get("temporal_upsampling", "")
+ video_spatial_upsampling = configs.get("spatial_upsampling", "")
+ video_MMAudio_setting = configs.get("MMAudio_setting", 0)
+ video_MMAudio_prompt = configs.get("MMAudio_prompt", "")
+ video_MMAudio_neg_prompt = configs.get("MMAudio_neg_prompt", "")
+ values = [video_model_name, video_prompt]
+ labels = ["Model", "Text Prompt"]
+ if len(video_other_prompts) >0 :
+ values += [video_other_prompts]
+ labels += ["Other Prompts"]
++ if len(video_outpainting) >0 :
++ values += [video_outpainting]
++ labels += ["Outpainting"]
+ values += [video_resolution, video_length_summary, video_seed, video_guidance_scale, video_flow_shift, video_num_inference_steps]
+ labels += [ "Resolution", "Video Length", "Seed", video_guidance_label, "Flow Shift", "Num Inference steps"]
+
+ video_skip_steps_cache_type = configs.get("skip_steps_cache_type", "")
+ video_skip_steps_multiplier = configs.get("skip_steps_multiplier", 0)
+ video_skip_steps_cache_start_step_perc = configs.get("skip_steps_start_step_perc", 0)
+ if len(video_skip_steps_cache_type) > 0:
+ video_skip_steps_cache = "TeaCache" if video_skip_steps_cache_type == "tea" else "MagCache"
+ video_skip_steps_cache += f" x{video_skip_steps_multiplier }"
+ if video_skip_steps_cache_start_step_perc >0: video_skip_steps_cache += f", Start from {video_skip_steps_cache_start_step_perc}%"
+ values += [ video_skip_steps_cache ]
+ labels += [ "Skip Steps" ]
+
+ if len(video_spatial_upsampling) > 0:
+ video_temporal_upsampling += " " + video_spatial_upsampling
+ if len(video_temporal_upsampling) > 0:
+ values += [ video_temporal_upsampling ]
+ labels += [ "Upsampling" ]
+ if video_MMAudio_setting != 0:
+ values += [ f'Prompt="{video_MMAudio_prompt}", Neg Prompt="{video_MMAudio_neg_prompt}", Seed={video_MMAudio_seed}' ]
+ labels += [ "MMAudio" ]
+
+ if len(video_activated_loras) > 0:
+ values += [video_activated_loras]
+ labels += ["Loras"]
+ values += [ video_creation_date, video_generation_time ]
+ labels += [ "Creation Date", "Generation Time" ]
+
+ table_style = """<STYLE>
+ #video_info, #video_info TR, #video_info TD {
+ background-color: transparent;
+ color: inherit;
+ padding: 4px;
+ border:0px !important;
+ font-size:12px;
+ }
+ </STYLE>
+ """
+ rows = [f"<TR><TD style='text-align: right;' WIDTH=1% NOWRAP VALIGN=TOP>{label}</TD><TD><B>{value}</B></TD></TR>" for label, value in zip(labels, values)]
+ html = f"{table_style}<TABLE ID=video_info WIDTH=100%>" + "".join(rows) + "</TABLE>"
+ else:
+ html = get_default_video_info()
+ visible= len(file_list) > 0
+ return choice, html, gr.update(visible=visible), gr.update(visible=visible)
def expand_slist(slist, num_inference_steps ):
new_slist= []
@@@ -4054,7 -3588,7 +4062,7 @@@ def generate_video
preprocess_type = process_map.get(process_letter, "vace")
else:
preprocess_type2 = process_map.get(process_letter, None)
-- process_names = { "pose": "Open Pose", "depth": "Depth Mask", "scribble" : "Shapes", "flow" : "Flow Map", "gray" : "Gray Levels", "inpaint" : "Inpaint Mask", "identity": "Identity Mask", "vace" : "Vace Data"}
++ process_names = { "pose": "Open Pose", "depth": "Depth Mask", "scribble" : "Shapes", "flow" : "Flow Map", "gray" : "Gray Levels", "inpaint" : "Inpaint Mask", "U": "Identity Mask", "vace" : "Vace Data"}
status_info = "Extracting " + process_names[preprocess_type]
extra_process_list = ([] if preprocess_type2==None else [preprocess_type2]) + ([] if process_outside_mask==None or process_outside_mask == preprocess_type else [process_outside_mask])
if len(extra_process_list) == 1: