SwordElucidator commited on
Commit
9ad10c7
1 Parent(s): 4dc717b

Update handler.py

Browse files
Files changed (1) hide show
  1. handler.py +3 -4
handler.py CHANGED
@@ -45,8 +45,7 @@ class EndpointHandler():
45
 
46
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
47
  image = data['inputs'].pop("image", None)
 
 
48
  image = Image.open(BytesIO(base64.b64decode(image)))
49
-
50
- caption = self.run_example(image, '<MORE_DETAILED_CAPTION>')
51
- ocr = self.run_example(image, '<OCR>')
52
- return {**caption, **ocr}
 
45
 
46
  def __call__(self, data: Any) -> List[List[Dict[str, float]]]:
47
  image = data['inputs'].pop("image", None)
48
+ type = data['inputs'].pop("type", '<MORE_DETAILED_CAPTION>')
49
+ text = data['inputs'].pop("text", None)
50
  image = Image.open(BytesIO(base64.b64decode(image)))
51
+ return self.run_example(image, type, text_input=text)