File size: 360 Bytes
cf509fc |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
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])
|