rahul7star commited on
Commit
f004efe
·
verified ·
1 Parent(s): 89e5e73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +39 -3
app.py CHANGED
@@ -103,7 +103,43 @@ def generate_video(
103
  randomize_seed = False,
104
  progress=gr.Progress(track_tqdm=True),
105
  ):
106
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  if input_image is None:
108
  raise gr.Error("Please upload an input image.")
109
 
@@ -130,8 +166,8 @@ def generate_video(
130
  return video_path, current_seed
131
 
132
  with gr.Blocks() as demo:
133
- gr.Markdown("# Fast 4 steps Wan 2.2 Wan-AI/Wan2.2-I2V-A14B-Diffusers")
134
- #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")
135
  with gr.Row():
136
  with gr.Column():
137
  input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")
 
103
  randomize_seed = False,
104
  progress=gr.Progress(track_tqdm=True),
105
  ):
106
+ """
107
+ Generate a video from an input image using the Wan 2.1 I2V model with CausVid LoRA.
108
+
109
+ This function takes an input image and generates a video animation based on the provided
110
+ prompt and parameters. It uses the Wan 2.1 14B Image-to-Video model with CausVid LoRA
111
+ for fast generation in 4-8 steps.
112
+
113
+ Args:
114
+ input_image (PIL.Image): The input image to animate. Will be resized to target dimensions.
115
+ prompt (str): Text prompt describing the desired animation or motion.
116
+ negative_prompt (str, optional): Negative prompt to avoid unwanted elements.
117
+ Defaults to default_negative_prompt (contains unwanted visual artifacts).
118
+ num_frames (int, optional): Number of frames.
119
+ Defaults to MAX_FRAMES_MODEL
120
+ guidance_scale (float, optional): Controls adherence to the prompt. Higher values = more adherence.
121
+ Defaults to 1.0. Range: 0.0-20.0.
122
+ steps (int, optional): Number of inference steps. More steps = higher quality but slower.
123
+ Defaults to 4. Range: 1-30.
124
+ seed (int, optional): Random seed for reproducible results. Defaults to 42.
125
+ Range: 0 to MAX_SEED (2147483647).
126
+ randomize_seed (bool, optional): Whether to use a random seed instead of the provided seed.
127
+ Defaults to False.
128
+ progress (gr.Progress, optional): Gradio progress tracker. Defaults to gr.Progress(track_tqdm=True).
129
+
130
+ Returns:
131
+ tuple: A tuple containing:
132
+ - video_path (str): Path to the generated video file (.mp4)
133
+ - current_seed (int): The seed used for generation (useful when randomize_seed=True)
134
+
135
+ Raises:
136
+ gr.Error: If input_image is None (no image uploaded).
137
+
138
+ Note:
139
+ - The function automatically resizes the input image to the target dimensions
140
+ - Output dimensions are adjusted to be multiples of MOD_VALUE (32)
141
+ - The function uses GPU acceleration via the @spaces.GPU decorator
142
+ """
143
  if input_image is None:
144
  raise gr.Error("Please upload an input image.")
145
 
 
166
  return video_path, current_seed
167
 
168
  with gr.Blocks() as demo:
169
+ gr.Markdown("# Fast 4 steps Wan 2.1 I2V (14B) with CausVid LoRA")
170
+ 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")
171
  with gr.Row():
172
  with gr.Column():
173
  input_image_component = gr.Image(type="pil", label="Input Image (auto-resized to target H/W)")