class Decoder: | |
def __init__(self): | |
import pickle | |
with open('pipeline/preprocessing/encoder_toxicity.pkl', 'rb') as v: | |
self.__encoder_toxicity = pickle.load(v) | |
with open('pipeline/preprocessing/encoder_emotion.pkl', 'rb') as v: | |
self.__encoder_emotion = pickle.load(v) | |
# Decoding one-hot encoded labels | |
def toxicity(self,pred): | |
return self.__encoder_toxicity.inverse_transform(pred) | |
def emotion(self,pred): | |
return self.__encoder_emotion.inverse_transform(pred) |