Skip to content

Commit

Permalink
Improve inference output
Browse files Browse the repository at this point in the history
  • Loading branch information
brunneis committed Jun 17, 2024
1 parent 5313ef9 commit ba1672d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fastc/classifiers/centroids.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ def predict(
for label, score in zip(dot_products.keys(), softmax_scores)
}

yield scores
result = {
'label': max(scores, key=scores.get),
'scores': scores,
}

yield result

def predict_one(self, text: str) -> Dict[int, float]:
return list(self.predict([text]))[0]
Expand Down

0 comments on commit ba1672d

Please sign in to comment.