rahul7star's picture
Create app.py
9432369 verified
raw
history blame
1.27 kB
import streamlit as st
import subprocess
import os
# Title
st.title("πŸŽ₯ WAN 2.1 - 14B T-V")
# Input fields
prompt = st.text_area("Enter your text prompt:", "A Tiger walking.")
frame_num = st.slider("Number of frames:", min_value=30, max_value=120, value=60, step=10)
resolution = st.selectbox("Select resolution:", ["200*200", "1280*720"])
sample_steps = st.slider("Sampling steps:", min_value=10, max_value=50, value=20, step=5)
# Button to generate video
if st.button("Generate Video"):
st.info("Generating video... This may take a few minutes.")
# Run WAN 2.1 - 14B Model
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}\""
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = process.communicate()
# Print logs for debugging
st.text_area("πŸ“œ Logs", stdout.decode() + stderr.decode())
# Check if video was created
if os.path.exists("output.mp4"):
st.video("output.mp4")
st.success("βœ… Video generated successfully!")
else:
st.error("❌ Video generation failed! Check logs above.")