OmPrakashSingh1704 commited on
Commit
a4dc2bc
·
1 Parent(s): aa5e404
options/Video_model/Model.py CHANGED
@@ -3,6 +3,8 @@ from diffusers import StableVideoDiffusionPipeline
3
  from diffusers.utils import load_image, export_to_video
4
  from PIL import Image
5
 
 
 
6
  pipeline = StableVideoDiffusionPipeline.from_pretrained(
7
  "stabilityai/stable-video-diffusion-img2vid-xt-1-1", torch_dtype=torch.float16, variant="fp16"
8
  )
@@ -13,6 +15,6 @@ def Video(image):
13
  image = image.resize((1024, 576))
14
 
15
  generator = torch.manual_seed(42)
16
- frames = pipeline(image, decode_chunk_size=8, generator=generator).frames[0]
17
  export_to_video(frames, "generated.mp4", fps=7)
18
  return "generated.mp4"
 
3
  from diffusers.utils import load_image, export_to_video
4
  from PIL import Image
5
 
6
+ device="cuda" if torch.cuda.is_available() else "cpu"
7
+
8
  pipeline = StableVideoDiffusionPipeline.from_pretrained(
9
  "stabilityai/stable-video-diffusion-img2vid-xt-1-1", torch_dtype=torch.float16, variant="fp16"
10
  )
 
15
  image = image.resize((1024, 576))
16
 
17
  generator = torch.manual_seed(42)
18
+ frames = pipeline(image, decode_chunk_size=8, generator=generator,device=device).frames[0]
19
  export_to_video(frames, "generated.mp4", fps=7)
20
  return "generated.mp4"
options/Video_model/__pycache__/Model.cpython-310.pyc CHANGED
Binary files a/options/Video_model/__pycache__/Model.cpython-310.pyc and b/options/Video_model/__pycache__/Model.cpython-310.pyc differ