import numpy as np from sklearn.naive_bayes import GaussianNB from sklearn import metrics import pickle import os def prediction_generator(list_): # This method need a np. array. # Therefore this method needs the imports: # import pandas as pd # import pickle # In the folder models.py # @return one it with the prediction x = np.asarray(list_, dtype=np.float32) # -------------- # Create model # -------------- sfilename = os.getcwd()+'/'+'model.sav' # load the model from disk model = pickle.load(open(sfilename, 'rb')) x = x.reshape(1, -1) y_pred = model.predict(x) iY_pred = int(y_pred) return iY_pred