oscarfu0501 commited on
Commit
24536fd
·
verified ·
1 Parent(s): 155d423

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +2 -6
handler.py CHANGED
@@ -34,12 +34,8 @@ class EndpointHandler():
34
  # print(imageURL)
35
  # print(text)
36
  # image = Image.open(requests.get(imageBase64, stream=True).raw)
37
- base64_data = imageBase64.split(",")[1]
38
- image_data = base64.b64decode(base64_data)
39
- # print(image_data)
40
- # Open the image
41
- image = Image.open((image_data))
42
- # image = Image.open(BytesIO(base64.b64decode(imageBase64.split(",")[1].encode())))
43
  inputs = self.processor(text=text, images=image, return_tensors="pt", padding=True)
44
  outputs = self.model(**inputs)
45
  embeddings = outputs.image_embeds.detach().numpy().flatten().tolist()
 
34
  # print(imageURL)
35
  # print(text)
36
  # image = Image.open(requests.get(imageBase64, stream=True).raw)
37
+
38
+ image = Image.open(BytesIO(base64.b64decode(imageBase64.split(",")[1].encode())))
 
 
 
 
39
  inputs = self.processor(text=text, images=image, return_tensors="pt", padding=True)
40
  outputs = self.model(**inputs)
41
  embeddings = outputs.image_embeds.detach().numpy().flatten().tolist()