class Prediction: | |
def __init__(self, label: str, score: float): | |
self.label = label | |
self.score = score | |
def from_output(dictionary: dict): | |
return Prediction(Prediction.get_label(dictionary["label"]), dictionary["score"]) | |
def get_label(label: str): | |
return int(label.split('_')[1]) | |