Update handler.py
Browse files- handler.py +3 -3
handler.py
CHANGED
@@ -16,8 +16,8 @@ class EndpointHandler():
|
|
16 |
inputs = data.pop("inputs", data)
|
17 |
|
18 |
image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
|
19 |
-
inputs = self.processor(image, return_tensors="pt").to(device)
|
20 |
-
outputs = self.model(**inputs)
|
21 |
|
22 |
-
return self.processor.decode(
|
23 |
|
|
|
16 |
inputs = data.pop("inputs", data)
|
17 |
|
18 |
image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
|
19 |
+
inputs = self.processor(image, inputs['text'], return_tensors="pt").to(device)
|
20 |
+
outputs = self.model.generate(**inputs)
|
21 |
|
22 |
+
return self.processor.decode(out[0], skip_special_tokens=True)
|
23 |
|