Update handler.py
Browse files- handler.py +2 -6
handler.py
CHANGED
@@ -34,12 +34,8 @@ class EndpointHandler():
|
|
34 |
# print(imageURL)
|
35 |
# print(text)
|
36 |
# image = Image.open(requests.get(imageBase64, stream=True).raw)
|
37 |
-
|
38 |
-
|
39 |
-
# print(image_data)
|
40 |
-
# Open the image
|
41 |
-
image = Image.open((image_data))
|
42 |
-
# image = Image.open(BytesIO(base64.b64decode(imageBase64.split(",")[1].encode())))
|
43 |
inputs = self.processor(text=text, images=image, return_tensors="pt", padding=True)
|
44 |
outputs = self.model(**inputs)
|
45 |
embeddings = outputs.image_embeds.detach().numpy().flatten().tolist()
|
|
|
34 |
# print(imageURL)
|
35 |
# print(text)
|
36 |
# image = Image.open(requests.get(imageBase64, stream=True).raw)
|
37 |
+
|
38 |
+
image = Image.open(BytesIO(base64.b64decode(imageBase64.split(",")[1].encode())))
|
|
|
|
|
|
|
|
|
39 |
inputs = self.processor(text=text, images=image, return_tensors="pt", padding=True)
|
40 |
outputs = self.model(**inputs)
|
41 |
embeddings = outputs.image_embeds.detach().numpy().flatten().tolist()
|