import numpy as np import model_2 model = model_2.model cols = model_2.target2.columns def encode(encoders, input_data): model_input=[] for i in range(len(input_data)): row=[] for j in range(18): row.extend(encoders[j].transform([input_data.iloc[i][j]])) model_input.append(row) model_input=np.array(model_input) return model_input def input_output(user_input): model_input=encode(model_2.encoders, user_input) output=model.predict(model_input) final_result = cols[np.argmax(output)] return final_result