jeff-RQ commited on
Commit
2a7e830
1 Parent(s): 1b7b927

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -8
handler.py CHANGED
@@ -19,15 +19,10 @@ class EndpointHandler:
19
  data = data.pop("inputs", data)
20
  text = data.pop("text", data)
21
 
22
- image_string_1 = base64.b64decode(data["image1"])
23
- image_1 = Image.open(io.BytesIO(image_string_1))
24
- print(image_1.size)
25
 
26
- image_string_2 = base64.b64decode(data["image2"])
27
- image_2 = Image.open(io.BytesIO(image_string_2))
28
- print(image_2.size)
29
-
30
- inputs = self.processor(images=[image_1, image_2], text=text, return_tensors="pt").to(self.device, torch.float16)
31
  generated_ids = self.model.generate(**inputs)
32
  generated_text = self.processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
33
 
 
19
  data = data.pop("inputs", data)
20
  text = data.pop("text", data)
21
 
22
+ image_string = base64.b64decode(data["image"])
23
+ image = Image.open(io.BytesIO(image_string))
 
24
 
25
+ inputs = self.processor(images=image, text=text, return_tensors="pt").to(self.device, torch.float16)
 
 
 
 
26
  generated_ids = self.model.generate(**inputs)
27
  generated_text = self.processor.batch_decode(generated_ids, skip_special_tokens=True)[0].strip()
28