Spaces:
Running
Running
Update jina_fewshot.py
Browse files- jina_fewshot.py +2 -1
jina_fewshot.py
CHANGED
|
@@ -260,7 +260,8 @@ class JinaCLIPv2Encoder:
|
|
| 260 |
def encode_images(self, images: list[Image.Image], dim: int = TRUNCATE_DIM) -> np.ndarray:
|
| 261 |
rgb = [img.convert("RGB") for img in images]
|
| 262 |
processed = self.image_processor(rgb, return_tensors="np")
|
| 263 |
-
|
|
|
|
| 264 |
|
| 265 |
embs = self._run_image(pixel_values)
|
| 266 |
if dim and dim < embs.shape[-1]:
|
|
|
|
| 260 |
def encode_images(self, images: list[Image.Image], dim: int = TRUNCATE_DIM) -> np.ndarray:
|
| 261 |
rgb = [img.convert("RGB") for img in images]
|
| 262 |
processed = self.image_processor(rgb, return_tensors="np")
|
| 263 |
+
pv = processed["pixel_values"]
|
| 264 |
+
pixel_values = pv.numpy().astype(np.float32) if hasattr(pv, "numpy") else np.asarray(pv, dtype=np.float32)
|
| 265 |
|
| 266 |
embs = self._run_image(pixel_values)
|
| 267 |
if dim and dim < embs.shape[-1]:
|