Fixed everything.
Browse files
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
|