speedartificialintelligence1122 commited on
Commit
1b3604f
Β·
verified Β·
1 Parent(s): 720abc6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -11
app.py CHANGED
@@ -1,16 +1,12 @@
 
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()
 
1
+ from diffusers import DiffusionPipeline
2
  import gradio as gr
3
  import torch
 
4
 
5
+ pipe = DiffusionPipeline.from_pretrained("cerspense/zeroscope_v2_576w", torch_dtype=torch.float16)
6
+ pipe.to("cuda")
 
 
7
 
8
+ def generate(prompt):
9
+ video_frames = pipe(prompt, num_inference_steps=25).frames
10
+ return video_frames[0] # return first frame or full video logic
11
 
12
+ gr.Interface(fn=generate, inputs="text", outputs="image").launch()