philschmid HF staff commited on
Commit
9982797
·
1 Parent(s): 7a72ef4

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +4 -2
pipeline.py CHANGED
@@ -17,9 +17,11 @@ class PreTrainedPipeline():
17
  Return:
18
  A :obj:`list`:. The list contains items that are dicts should be liked {"label": "XXX", "score": 0.82}
19
  """
 
 
20
  # decode base64 image to PIL
21
- image = Image.open(BytesIO(base64.b64decode(data['image'])))
22
 
23
  # run prediction one image wit provided candiates
24
- prediction = self.pipeline(images=[image], candidate_labels=data["candiates"])
25
  return prediction[0]
 
17
  Return:
18
  A :obj:`list`:. The list contains items that are dicts should be liked {"label": "XXX", "score": 0.82}
19
  """
20
+ inputs = data.pop("inputs", data)
21
+
22
  # decode base64 image to PIL
23
+ image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
24
 
25
  # run prediction one image wit provided candiates
26
+ prediction = self.pipeline(images=[image], candidate_labels=inputs["candiates"])
27
  return prediction[0]