dariadaria commited on
Commit
3f14abd
·
1 Parent(s): f93531b

handler output reformating

Browse files
Files changed (1) hide show
  1. handler.py +3 -2
handler.py CHANGED
@@ -47,6 +47,7 @@ class EndpointHandler:
47
  output = self.model(**tokenized_inputs)
48
  predictions = torch.argmax(output.logits, dim=-1).numpy(force=True)
49
  batch['label'] = [self.model.config.id2label[p] for p in predictions]
50
- batch.pop('text')
51
 
52
- return batch
 
 
 
47
  output = self.model(**tokenized_inputs)
48
  predictions = torch.argmax(output.logits, dim=-1).numpy(force=True)
49
  batch['label'] = [self.model.config.id2label[p] for p in predictions]
 
50
 
51
+ n = len(test_dict['id'])
52
+ result = [{key : value[i] for key, value in test_dict.items() if key not in ('text')} for i in range(n)]
53
+ return result