florentgbelidji HF staff commited on
Commit
e53bc58
·
1 Parent(s): 2ac6664

Update pipeline.py

Browse files
Files changed (1) hide show
  1. pipeline.py +2 -2
pipeline.py CHANGED
@@ -42,11 +42,11 @@ class PreTrainedPipeline():
42
  A :obj:`dict`:. The object returned should be a dict of one list like [[{"label": 0.9939950108528137}]] containing :
43
  - "caption": A string corresponding to the generated caption.
44
  """
45
- image = data.pop("inputs", data)
46
  parameters = data.pop("parameters", {})
47
 
48
  # decode base64 image to PIL
49
- image = Image.open(BytesIO(base64.b64decode(image)))
50
  image = self.transform(image).unsqueeze(0).to(device)
51
  with torch.no_grad():
52
  caption = self.model.generate(
 
42
  A :obj:`dict`:. The object returned should be a dict of one list like [[{"label": 0.9939950108528137}]] containing :
43
  - "caption": A string corresponding to the generated caption.
44
  """
45
+ inputs = data.pop("inputs", data)
46
  parameters = data.pop("parameters", {})
47
 
48
  # decode base64 image to PIL
49
+ image = Image.open(BytesIO(base64.b64decode(inputs['image'])))
50
  image = self.transform(image).unsqueeze(0).to(device)
51
  with torch.no_grad():
52
  caption = self.model.generate(