Jeney commited on
Commit
402c710
1 Parent(s): 3d19edf

Fix __call__

Browse files
Files changed (1) hide show
  1. handler.py +3 -4
handler.py CHANGED
@@ -15,12 +15,11 @@ class EndpointHandler:
15
  # process input
16
  image = data.pop("image", data)
17
  text = data.pop("text", data)
18
- parameters = data.pop("parameters", None)
19
 
20
  # preprocess
21
- encoding = processor(image, text, return_tensors="pt")
22
- outputs = model(**encoding)
23
  # postprocess the prediction
24
  logits = outputs.logits
25
  idx = logits.argmax(-1).item()
26
- return [{"answer": model.config.id2label[idx]}]
 
15
  # process input
16
  image = data.pop("image", data)
17
  text = data.pop("text", data)
 
18
 
19
  # preprocess
20
+ encoding = self.processor(image, text, return_tensors="pt")
21
+ outputs = self.model(**encoding)
22
  # postprocess the prediction
23
  logits = outputs.logits
24
  idx = logits.argmax(-1).item()
25
+ return [{"answer": self.model.config.id2label[idx]}]