rahul7star commited on
Commit
9432369
·
verified ·
1 Parent(s): d2f1a13

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +32 -0
app.py ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import subprocess
3
+ import os
4
+
5
+ # Title
6
+ st.title("🎥 WAN 2.1 - 14B T-V")
7
+
8
+ # Input fields
9
+ prompt = st.text_area("Enter your text prompt:", "A Tiger walking.")
10
+ frame_num = st.slider("Number of frames:", min_value=30, max_value=120, value=60, step=10)
11
+ resolution = st.selectbox("Select resolution:", ["200*200", "1280*720"])
12
+ sample_steps = st.slider("Sampling steps:", min_value=10, max_value=50, value=20, step=5)
13
+
14
+ # Button to generate video
15
+ if st.button("Generate Video"):
16
+ st.info("Generating video... This may take a few minutes.")
17
+
18
+ # Run WAN 2.1 - 14B Model
19
+ command = f"python generate.py --task t2v-14B --size {resolution} --frame_num {frame_num} --sample_steps {sample_steps} --ckpt_dir ./Wan2.1-T2V-14B --offload_model True --prompt \"{prompt}\""
20
+
21
+ process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
22
+ stdout, stderr = process.communicate()
23
+
24
+ # Print logs for debugging
25
+ st.text_area("📜 Logs", stdout.decode() + stderr.decode())
26
+
27
+ # Check if video was created
28
+ if os.path.exists("output.mp4"):
29
+ st.video("output.mp4")
30
+ st.success("✅ Video generated successfully!")
31
+ else:
32
+ st.error("❌ Video generation failed! Check logs above.")