def pred(model, X, char_set, label_set, post_correction): pred_res = model.predict(X) pred_res = [one_hot_decoder(i, char_set) for i in pred_res] pred_res = [list2str(i) for i in pred_res] # post correction if post_correction: pred_res = correction(pred_res, label_set) return pred_res
def pred(self, X): pred_res = self.model.predict(X, batch_size=256) self.pred_probs = pred_res pred_res = [one_hot_decoder(i, self.char_set) for i in pred_res] pred_res = [list2str(i) for i in pred_res] # post correction if self.post_correction: pred_res = correction(pred_res, self.label_set) return pred_res