Upload handler.py
Browse files- handler.py +2 -4
handler.py
CHANGED
@@ -26,13 +26,11 @@ class EndpointHandler():
|
|
26 |
- "description": A string corresponding to the generated description.
|
27 |
"""
|
28 |
|
29 |
-
|
30 |
text = data.get("text", "")
|
31 |
parameters = data.pop("parameters", {})
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
processed_image = self.processor(images=raw_images, text=text, return_tensors="pt")
|
36 |
processed_image["pixel_values"] = processed_image["pixel_values"].to(device)
|
37 |
processed_image = {**processed_image, **parameters}
|
38 |
|
|
|
26 |
- "description": A string corresponding to the generated description.
|
27 |
"""
|
28 |
|
29 |
+
images = data.pop("inputs", data)
|
30 |
text = data.get("text", "")
|
31 |
parameters = data.pop("parameters", {})
|
32 |
|
33 |
+
processed_image = self.processor(images=images, text=text, return_tensors="pt")
|
|
|
|
|
34 |
processed_image["pixel_values"] = processed_image["pixel_values"].to(device)
|
35 |
processed_image = {**processed_image, **parameters}
|
36 |
|