This commit is contained in:
Alexander Munch-Hansen 2019-04-07 00:03:50 +02:00
parent 65a49dfb95
commit fa63cb9e06
1 changed files with 3 additions and 1 deletions

View File

@ -1,3 +1,5 @@
from pathlib import Path
from sklearn import svm
from sklearn.externals import joblib
import requests
@ -36,7 +38,7 @@ def train():
joblib.dump(classifier, "nightness_classifier.pkl")
def predict(X):
classifier = joblib.load("nightness_classifier.pkl")
classifier = joblib.load(str(Path(__file__).parent.joinpath("nightness_classifier.pkl")))
prob = classifier.predict_proba(np.array(X).reshape(1, -1))
return prob[0, 1]