ihsanvp commited on
Commit
659dcf7
1 Parent(s): 4232798

fix: spaces run error

Browse files
Files changed (1) hide show
  1. app.py +2 -0
app.py CHANGED
@@ -6,10 +6,12 @@ from diffusers.utils.loading_utils import load_image
6
  from PIL import Image
7
 
8
  def generate(image: Image.Image, prompt: str):
 
9
  negative_prompt = "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
10
  generator = torch.manual_seed(8888)
11
  image = image.convert("RGB")
12
  pipeline = I2VGenXLPipeline.from_pretrained("ali-vilab/i2vgen-xl", torch_dtype=torch.float16, variant="fp16")
 
13
  pipeline.enable_model_cpu_offload()
14
  pipeline.unet.enable_forward_chunking()
15
  frames = pipeline(
 
6
  from PIL import Image
7
 
8
  def generate(image: Image.Image, prompt: str):
9
+ device = torch.device("cpu")
10
  negative_prompt = "Distorted, discontinuous, Ugly, blurry, low resolution, motionless, static, disfigured, disconnected limbs, Ugly faces, incomplete arms"
11
  generator = torch.manual_seed(8888)
12
  image = image.convert("RGB")
13
  pipeline = I2VGenXLPipeline.from_pretrained("ali-vilab/i2vgen-xl", torch_dtype=torch.float16, variant="fp16")
14
+ pipeline.to(device)
15
  pipeline.enable_model_cpu_offload()
16
  pipeline.unet.enable_forward_chunking()
17
  frames = pipeline(