BullseyeMxP commited on
Commit
a351b6b
1 Parent(s): 473d5bf

Fixed everything.

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -182,8 +182,9 @@ def stream_chat(input_image: Image.Image, caption_type: str, caption_length: str
182
 
183
  # Preprocess image
184
  image = input_image.resize((384, 384), Image.LANCZOS)
 
185
  pixel_values = TVF.pil_to_tensor(image).unsqueeze(0) / 255.0
186
- pixel_values = TVF.normalize(pixel_values, [0.5], [0.5])
187
  pixel_values = pixel_values.to('cuda', dtype=torch.float16)
188
 
189
  # Embed image
 
182
 
183
  # Preprocess image
184
  image = input_image.resize((384, 384), Image.LANCZOS)
185
+ image = image.convert('RGB') # Ensure the image has 3 channels
186
  pixel_values = TVF.pil_to_tensor(image).unsqueeze(0) / 255.0
187
+ pixel_values = TVF.normalize(pixel_values, [0.5, 0.5, 0.5], [0.5, 0.5, 0.5]) # Normalize for all 3 channels
188
  pixel_values = pixel_values.to('cuda', dtype=torch.float16)
189
 
190
  # Embed image