rahul7star commited on
Commit
0aab1ad
·
verified ·
1 Parent(s): 899a344

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -40
app.py CHANGED
@@ -106,45 +106,7 @@ def generate_video(
106
  randomize_seed = False,
107
  progress=gr.Progress(track_tqdm=True),
108
  ):
109
- """
110
- Generate a video from an input image using the Wan 2.1 I2V model with CausVid LoRA.
111
 
112
- This function takes an input image and generates a video animation based on the provided
113
- prompt and parameters. It uses the Wan 2.1 14B Image-to-Video model with CausVid LoRA
114
- for fast generation in 4-8 steps.
115
-
116
- Args:
117
- input_image (PIL.Image): The input image to animate. Will be resized to target dimensions.
118
- prompt (str): Text prompt describing the desired animation or motion.
119
- negative_prompt (str, optional): Negative prompt to avoid unwanted elements.
120
- Defaults to default_negative_prompt (contains unwanted visual artifacts).
121
- duration_seconds (float, optional): Duration of the generated video in seconds.
122
- Defaults to 2. Clamped between MIN_FRAMES_MODEL/FIXED_FPS and MAX_FRAMES_MODEL/FIXED_FPS.
123
- guidance_scale (float, optional): Controls adherence to the prompt. Higher values = more adherence.
124
- Defaults to 1.0. Range: 0.0-20.0.
125
- steps (int, optional): Number of inference steps. More steps = higher quality but slower.
126
- Defaults to 4. Range: 1-30.
127
- seed (int, optional): Random seed for reproducible results. Defaults to 42.
128
- Range: 0 to MAX_SEED (2147483647).
129
- randomize_seed (bool, optional): Whether to use a random seed instead of the provided seed.
130
- Defaults to False.
131
- progress (gr.Progress, optional): Gradio progress tracker. Defaults to gr.Progress(track_tqdm=True).
132
-
133
- Returns:
134
- tuple: A tuple containing:
135
- - video_path (str): Path to the generated video file (.mp4)
136
- - current_seed (int): The seed used for generation (useful when randomize_seed=True)
137
-
138
- Raises:
139
- gr.Error: If input_image is None (no image uploaded).
140
-
141
- Note:
142
- - The function automatically resizes the input image to the target dimensions
143
- - Frame count is calculated as duration_seconds * FIXED_FPS (24)
144
- - Output dimensions are adjusted to be multiples of MOD_VALUE (32)
145
- - The function uses GPU acceleration via the @spaces.GPU decorator
146
- - Generation time varies based on steps and duration (see get_duration function)
147
- """
148
  if input_image is None:
149
  raise gr.Error("Please upload an input image.")
150
 
@@ -172,8 +134,8 @@ def generate_video(
172
  return video_path, current_seed
173
 
174
  with gr.Blocks() as demo:
175
- gr.Markdown("# Fast 4 steps Wan 2.1 I2V (14B) with CausVid LoRA")
176
- gr.Markdown("[CausVid](https://github.com/tianweiy/CausVid) is a distilled version of Wan 2.1 to run faster in just 4-8 steps, [extracted as LoRA by Kijai](https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan21_CausVid_14B_T2V_lora_rank32.safetensors) and is compatible with 🧨 diffusers")
177
  with gr.Row():
178
  with gr.Column():
179
  input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")
 
106
  randomize_seed = False,
107
  progress=gr.Progress(track_tqdm=True),
108
  ):
 
 
109
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  if input_image is None:
111
  raise gr.Error("Please upload an input image.")
112
 
 
134
  return video_path, current_seed
135
 
136
  with gr.Blocks() as demo:
137
+ gr.Markdown("# Wan2.2-T2V-A14B AND I2V Testing")
138
+ #gr.Markdown("[CausVid](https://github.com/tianweiy/CausVid) is a distilled version of Wan 2.1 to run faster in just 4-8 steps, [extracted as LoRA by Kijai](https://huggingface.co/Kijai/WanVideo_comfy/blob/main/Wan21_CausVid_14B_T2V_lora_rank32.safetensors) and is compatible with 🧨 diffusers")
139
  with gr.Row():
140
  with gr.Column():
141
  input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")