Update handler.py
Browse files- handler.py +3 -3
handler.py
CHANGED
@@ -28,12 +28,12 @@ class EndpointHandler():
|
|
28 |
# }
|
29 |
|
30 |
inputs = data.get("inputs")
|
31 |
-
|
32 |
-
imageURL = inputs.get("image")
|
33 |
text = inputs.get("text")
|
34 |
# print(imageURL)
|
35 |
# print(text)
|
36 |
-
image = Image.open(requests.get(
|
37 |
# image = Image.open(BytesIO(base64.b64decode(imageBase64.split(",")[1].encode())))
|
38 |
inputs = self.processor(text=text, images=image, return_tensors="pt", padding=True)
|
39 |
outputs = self.model(**inputs)
|
|
|
28 |
# }
|
29 |
|
30 |
inputs = data.get("inputs")
|
31 |
+
imageBase64 = inputs.get("image")
|
32 |
+
# imageURL = inputs.get("image")
|
33 |
text = inputs.get("text")
|
34 |
# print(imageURL)
|
35 |
# print(text)
|
36 |
+
image = Image.open(requests.get(imageBase64, stream=True).raw)
|
37 |
# image = Image.open(BytesIO(base64.b64decode(imageBase64.split(",")[1].encode())))
|
38 |
inputs = self.processor(text=text, images=image, return_tensors="pt", padding=True)
|
39 |
outputs = self.model(**inputs)
|