pop image
Browse files- handler.py +2 -1
handler.py
CHANGED
|
@@ -22,7 +22,8 @@ class EndpointHandler():
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
words = data.pop("words", data)
|
| 25 |
-
|
|
|
|
| 26 |
inputs = self.processor(text=words, images=image, return_tensors="pt", padding=True)
|
| 27 |
outputs = self.model(**inputs)
|
| 28 |
embeddings = outputs.image_embeds.detach().numpy().flatten().tolist()
|
|
|
|
| 22 |
"""
|
| 23 |
|
| 24 |
words = data.pop("words", data)
|
| 25 |
+
imageData = data.pop("image", data)
|
| 26 |
+
image = Image.open(BytesIO(base64.b64decode(imageData)))
|
| 27 |
inputs = self.processor(text=words, images=image, return_tensors="pt", padding=True)
|
| 28 |
outputs = self.model(**inputs)
|
| 29 |
embeddings = outputs.image_embeds.detach().numpy().flatten().tolist()
|