Spaces:
Runtime error
Runtime error
Update app_pusa.py
Browse files13 unmodified lines1415161718192010 unmodified lines31323334353637120 unmodified lines15815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120213 unmodified lines# LORA_FILENAME = "Wan21_CausVid_bidirect2_T2V_1_3B_lora_rank32.safetensors"#MODEL_ID = "Wan-AI/Wan2.1-T2V-14B-Diffusers"10 unmodified lines#pusa testMODEL_ID = "Wan-AI/Wan2.1-T2V-14B"LORA_FILENAME = "Pusa/Wan21_PusaV1_LoRA_14B_rank512_bf16.safetensors"# LORA_REPO_ID = "RaphaelLiu/PusaV1"120 unmodified linesguidance_scale = 1, steps = 4,seed = 42, randomize_seed = False,progress=gr.Progress(track_tqdm=True)):"""Generate a video from a text prompt using the Wan 2.1 T2V model with CausVid LoRA.This function takes a text prompt and generates a video based on the providedprompt and parameters. It uses the Wan 2.1 1.3B Text-to-Video model with CausVid LoRAfor fast generation in 3-8 steps.Args:prompt (str): Text prompt describing the desired video content.height (int): Target height for the output video. Will be adjusted to multiple of MOD_VALUE (32).width (int): Target width for the output video. Will be adjusted to multiple of MOD_VALUE (32).negative_prompt (str, optional): Negative prompt to avoid unwanted elements.Defaults to default_negative_prompt (contains unwanted visual artifacts).duration_seconds (float, optional): Duration of the generated video in seconds.Defaults to 2. Clamped between MIN_FRAMES_MODEL/FIXED_FPS and MAX_FRAMES_MODEL/FIXED_FPS.guidance_scale (float, optional): Controls adherence to the prompt. Higher values = more adherence.Defaults to 1.0. Range: 0.0-20.0.steps (int, optional): Number of inference steps. More steps = higher quality but slower.Defaults to 4. Range: 1-30.seed (int, optional): Random seed for reproducible results. Defaults to 42.Range: 0 to MAX_SEED (2147483647).randomize_seed (bool, optional): Whether to use a random seed instead of the provided seed.Defaults to False.progress (gr.Progress, optional): Gradio progress tracker. Defaults to gr.Progress(track_tqdm=True).Returns:tuple: A tuple containing:- video_path (str): Path to the generated video file (.mp4)- current_seed (int): The seed used for generation (useful when randomize_seed=True)Raises:gr.Error: If prompt is empty or None.Note:- Frame count is calculated as duration_seconds * FIXED_FPS (24)- Output dimensions are adjusted to be multiples of MOD_VALUE (32)- The function uses GPU acceleration via the @spaces.GPU decorator- Generation time varies based on steps and duration (see get_duration function)"""if not prompt or prompt.strip() == "":raise gr.Error("Please enter a text prompt. Try to use long and precise descriptions.")13 unmodified lines1415161718192010 unmodified lines313233343536120 unmodified lines15715815916016116216313 unmodified lines# LORA_FILENAME = "Wan21_CausVid_bidirect2_T2V_1_3B_lora_rank32.safetensors"MODEL_ID = "Wan-AI/Wan2.1-T2V-14B-Diffusers"10 unmodified lines#pusa testLORA_FILENAME = "Pusa/Wan21_PusaV1_LoRA_14B_rank512_bf16.safetensors"# LORA_REPO_ID = "RaphaelLiu/PusaV1"120 unmodified linesguidance_scale = 1, steps = 4,seed = 42, randomize_seed = False,progress=gr.Progress(track_tqdm=True)):if not prompt or prompt.strip() == "":raise gr.Error("Please enter a text prompt. Try to use long and precise descriptions.")
app_pusa.py+2-41