Commit
f6bbf75
Β·
verified Β·
1 Parent(s): fc61e49

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import torch
3
+ from diffusers import AnimateDiffPipeline, DDIMScheduler
4
+
5
+ # Load AnimateDiff model (based on SDXL)
6
+ model_id = "cerspense/animation-diffusion-sdxl"
7
+ pipe = AnimateDiffPipeline.from_pretrained(model_id, torch_dtype=torch.float16).to("cuda")
8
+ pipe.scheduler = DDIMScheduler.from_config(pipe.scheduler.config)
9
+
10
+ def generate_video(prompt):
11
+ video = pipe(prompt, num_frames=16, guidance_scale=7.5).frames
12
+ return video[0]
13
+
14
+ gr.Interface(fn=generate_video,
15
+ inputs=gr.Textbox(label="Enter your prompt"),
16
+ outputs=gr.Video(label="Generated Video")).launch()