pls
This commit is contained in:
parent
65a49dfb95
commit
fa63cb9e06
|
@ -1,3 +1,5 @@
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
from sklearn import svm
|
from sklearn import svm
|
||||||
from sklearn.externals import joblib
|
from sklearn.externals import joblib
|
||||||
import requests
|
import requests
|
||||||
|
@ -36,7 +38,7 @@ def train():
|
||||||
joblib.dump(classifier, "nightness_classifier.pkl")
|
joblib.dump(classifier, "nightness_classifier.pkl")
|
||||||
|
|
||||||
def predict(X):
|
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))
|
prob = classifier.predict_proba(np.array(X).reshape(1, -1))
|
||||||
return prob[0, 1]
|
return prob[0, 1]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user