sguna commited on
Commit
0b0bb49
1 Parent(s): f83f8ef

Upload handler.py

Browse files
Files changed (1) hide show
  1. 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
- inputs = data.pop("inputs", data)
30
  text = data.get("text", "")
31
  parameters = data.pop("parameters", {})
32
 
33
- raw_images = Image.open(inputs).convert("RGB")
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