shhossain commited on
Commit
c64309c
1 Parent(s): ce2b713

Update sentpipeline.py

Browse files
Files changed (1) hide show
  1. sentpipeline.py +2 -7
sentpipeline.py CHANGED
@@ -21,14 +21,9 @@ class SentimentModelPipe(Pipeline):
21
  return self.smodel.encode(inputs, convert_to_tensor=True)
22
 
23
  def postprocess(self, outputs):
24
- if isinstance(outputs, torch.Tensor):
25
- outputs = [outputs]
26
  results = []
27
- for out in outputs:
28
- r = []
29
- for i, l in enumerate(out):
30
- r.append({"label": self.class_map[i], "score": l.item()})
31
- results.append(r)
32
  return results
33
 
34
  def _forward(self, tensor):
 
21
  return self.smodel.encode(inputs, convert_to_tensor=True)
22
 
23
  def postprocess(self, outputs):
 
 
24
  results = []
25
+ for i, l in enumerate(outputs):
26
+ results.append({"label": self.class_map[i], "score": l.item()})
 
 
 
27
  return results
28
 
29
  def _forward(self, tensor):