ManuelHuman commited on
Commit
d33c9ef
·
verified ·
1 Parent(s): 7425484

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -1,21 +1,21 @@
1
  import streamlit as st
2
  import torch
3
- from diffusers import WanPipeline
4
  from diffusers.utils import export_to_video
5
 
6
- # Load the Wan2.1 text-to-video pipeline (1.3B version) with half-precision weights
7
  st.write("Loading model... (first run may take a few minutes)")
8
 
9
- model_id = "Wan-AI/Wan2.1-T2V-1.3B-Diffusers"
10
- pipe = WanPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
11
 
12
- st.title("Wan2.1 Text-to-Video Generator")
13
  prompt = st.text_input("Enter a text prompt for the video:")
14
  frames = st.slider("Number of frames (video length)", min_value=8, max_value=81, value=24)
15
 
16
  if st.button("Generate Video") and prompt:
17
  with st.spinner("Generating video... this may take a while on CPU"):
18
- result = pipe(prompt=prompt, height=480, width=832, num_frames=frames, num_inference_steps=20)
19
  video_frames = result.frames # List of PIL images
20
  export_to_video(video_frames, "output.mp4", fps=8)
21
 
 
1
  import streamlit as st
2
  import torch
3
+ from diffusers import StableVideoDiffusionPipeline
4
  from diffusers.utils import export_to_video
5
 
6
+ # Load the video generation pipeline
7
  st.write("Loading model... (first run may take a few minutes)")
8
 
9
+ model_id = "stabilityai/stable-video-diffusion-img2vid"
10
+ pipe = StableVideoDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
11
 
12
+ st.title("Text-to-Video Generator")
13
  prompt = st.text_input("Enter a text prompt for the video:")
14
  frames = st.slider("Number of frames (video length)", min_value=8, max_value=81, value=24)
15
 
16
  if st.button("Generate Video") and prompt:
17
  with st.spinner("Generating video... this may take a while on CPU"):
18
+ result = pipe(prompt=prompt, num_frames=frames, num_inference_steps=20)
19
  video_frames = result.frames # List of PIL images
20
  export_to_video(video_frames, "output.mp4", fps=8)
21