sergeipetrov
commited on
Commit
•
14df57b
1
Parent(s):
1ccd760
Update handler.py
Browse files- handler.py +2 -2
handler.py
CHANGED
@@ -21,10 +21,10 @@ class EndpointHandler:
|
|
21 |
# move model to device
|
22 |
self.model.to(device)
|
23 |
|
24 |
-
def __call__(self, data: Any)
|
25 |
logger.info(f"data: {data}")
|
26 |
logger.info(f"data type: {type(data)}")
|
27 |
-
image = Image.open(BytesIO(base64.b64decode(data)))
|
28 |
logger.info("image read")
|
29 |
inputs = self.processor(image, return_tensors="pt")
|
30 |
outputs = self.model(**inputs)
|
|
|
21 |
# move model to device
|
22 |
self.model.to(device)
|
23 |
|
24 |
+
def __call__(self, data: Any):
|
25 |
logger.info(f"data: {data}")
|
26 |
logger.info(f"data type: {type(data)}")
|
27 |
+
image = Image.open(BytesIO(base64.b64decode(data["inputs"])))
|
28 |
logger.info("image read")
|
29 |
inputs = self.processor(image, return_tensors="pt")
|
30 |
outputs = self.model(**inputs)
|