1inkusFace commited on
Commit
fe9701a
·
verified ·
1 Parent(s): 7413101

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -91,7 +91,6 @@ def generate(segment, image, prompt, size, guidance_scale, num_inference_steps,
91
  prompt_embeds, prompt_attention_mask, negative_prompt_embeds, negative_attention_mask, pooled_prompt_embeds, negative_pooled_prompt_embeds = pipe.encode_prompt(
92
  prompt=prompt, do_classifier_free_guidance=True, negative_prompt=negative_prompt, device=device
93
  )
94
-
95
  transformer_dtype = pipe.transformer.dtype
96
  prompt_embeds = prompt_embeds.to(transformer_dtype)
97
  prompt_attention_mask = prompt_attention_mask.to(transformer_dtype)
@@ -102,7 +101,6 @@ def generate(segment, image, prompt, size, guidance_scale, num_inference_steps,
102
  prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds])
103
  prompt_attention_mask = torch.cat([negative_attention_mask, prompt_attention_mask])
104
  pooled_prompt_embeds = torch.cat([negative_pooled_prompt_embeds, pooled_prompt_embeds])
105
-
106
  pipe.scheduler.set_timesteps(num_inference_steps, device=device)
107
  timesteps = pipe.scheduler.timesteps
108
  all_timesteps_cpu = timesteps.cpu()
@@ -110,6 +108,8 @@ def generate(segment, image, prompt, size, guidance_scale, num_inference_steps,
110
  segment_timesteps = torch.from_numpy(timesteps_split_np[0]).to("cuda")
111
  num_channels_latents = pipe.transformer.config.in_channels
112
  num_channels_latents = int(num_channels_latents / 2)
 
 
113
  image = pipe.video_processor.preprocess(image, height=size, width=size).to(
114
  device, dtype=prompt_embeds.dtype
115
  )
 
91
  prompt_embeds, prompt_attention_mask, negative_prompt_embeds, negative_attention_mask, pooled_prompt_embeds, negative_pooled_prompt_embeds = pipe.encode_prompt(
92
  prompt=prompt, do_classifier_free_guidance=True, negative_prompt=negative_prompt, device=device
93
  )
 
94
  transformer_dtype = pipe.transformer.dtype
95
  prompt_embeds = prompt_embeds.to(transformer_dtype)
96
  prompt_attention_mask = prompt_attention_mask.to(transformer_dtype)
 
101
  prompt_embeds = torch.cat([negative_prompt_embeds, prompt_embeds])
102
  prompt_attention_mask = torch.cat([negative_attention_mask, prompt_attention_mask])
103
  pooled_prompt_embeds = torch.cat([negative_pooled_prompt_embeds, pooled_prompt_embeds])
 
104
  pipe.scheduler.set_timesteps(num_inference_steps, device=device)
105
  timesteps = pipe.scheduler.timesteps
106
  all_timesteps_cpu = timesteps.cpu()
 
108
  segment_timesteps = torch.from_numpy(timesteps_split_np[0]).to("cuda")
109
  num_channels_latents = pipe.transformer.config.in_channels
110
  num_channels_latents = int(num_channels_latents / 2)
111
+ image = Image.open(image.name).convert('RGB')
112
+ image.resize((size,size), Image.LANCZOS)
113
  image = pipe.video_processor.preprocess(image, height=size, width=size).to(
114
  device, dtype=prompt_embeds.dtype
115
  )