nlp-rgr / models /prediction.py
Max Bushuev
f
cf509fc
raw
history blame
No virus
360 Bytes
class Prediction:
def __init__(self, label: str, score: float):
self.label = label
self.score = score
@staticmethod
def from_output(dictionary: dict):
return Prediction(Prediction.get_label(dictionary["label"]), dictionary["score"])
@staticmethod
def get_label(label: str):
return int(label.split('_')[1])