Rawanie commited on
Commit
5bdc58a
·
verified ·
1 Parent(s): e1148c5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import TextToVideoPipeline
4
+
5
+ pipeline = TextToVideoPipeline.from_pretrained("damo-vilab/text-to-video-ms-1.7b", torch_dtype=torch.float16)
6
+ pipeline = pipeline.to("cuda")
7
+
8
+ def generate_video(prompt):
9
+ video_frames = pipeline(prompt, num_inference_steps=25).frames
10
+ return video_frames
11
+
12
+ interface = gr.Interface(
13
+ fn=generate_video,
14
+ inputs=gr.Textbox(lines=2, placeholder="Enter your prompt here..."),
15
+ outputs=gr.Video(),
16
+ title="Text to Video Generator",
17
+ description="Generate video from text prompt"
18
+ )
19
+
20
+ interface.launch()