(self, image_paths: List[str])
| 414 | return x |
| 415 | |
| 416 | def encode(self, image_paths: List[str]): |
| 417 | images = [] |
| 418 | for image_path in image_paths: |
| 419 | if image_path.startswith("http://") or image_path.startswith("https://"): |
| 420 | image = Image.open(requests.get(image_path, stream=True).raw) |
| 421 | else: |
| 422 | image = Image.open(image_path) |
| 423 | image = image.convert("RGB") |
| 424 | images.append(self.image_transform(image)) |
| 425 | images = torch.stack(images, dim=0) |
| 426 | return self(images) |
no outgoing calls
no test coverage detected