rahul7star commited on
Commit
f2dc9a9
·
verified ·
1 Parent(s): 25acec1

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import subprocess
3
+ from huggingface_hub import snapshot_download
4
+
5
+ # Step 1: Download model
6
+ repo_id = "Wan-AI/Wan2.2-TI2V-5B"
7
+ print(f"Downloading/loading checkpoints for {repo_id}...")
8
+ ckpt_dir = snapshot_download(repo_id, local_dir_use_symlinks=False)
9
+ print(f"Using checkpoints from {ckpt_dir}")
10
+
11
+ # Step 2: Define command arguments (same as your CLI example)
12
+ cmd = [
13
+ "python", "generate.py",
14
+ "--task", "ti2v-5B",
15
+ "--size", "1280*704",
16
+ "--ckpt_dir", ckpt_dir,
17
+ "--offload_model", "True",
18
+ "--convert_model_dtype",
19
+ "--t5_cpu",
20
+ "--image", "examples/i2v_input.JPG",
21
+ "--prompt", (
22
+ "Summer beach vacation style, a white cat wearing sunglasses sits on a surfboard. "
23
+ "The fluffy-furred feline gazes directly at the camera with a relaxed expression. "
24
+ "Blurred beach scenery forms the background featuring crystal-clear waters, distant green hills, "
25
+ "and a blue sky dotted with white clouds. The cat assumes a naturally relaxed posture, "
26
+ "as if savoring the sea breeze and warm sunlight. A close-up shot highlights the feline's "
27
+ "intricate details and the refreshing atmosphere of the seaside."
28
+ )
29
+ ]
30
+
31
+ # Step 3: Run the command
32
+ print("Running generate.py...")
33
+ subprocess.run(cmd, check=True)
34
+ print("Generation complete!")