Skip to content

Commit

Permalink
Merge pull request #678 from gsunner/jsondata-example
Browse files Browse the repository at this point in the history
scikit learn iris model using jsondata example
  • Loading branch information
ukclivecox authored Jul 15, 2019
2 parents db31555 + b6b69a7 commit 32de461
Show file tree
Hide file tree
Showing 6 changed files with 879 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/models/sklearn_iris_jsondata/.s2i/environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MODEL_NAME=IrisClassifier
API_TYPE=REST
SERVICE_TYPE=MODEL
PERSISTENCE=0
19 changes: 19 additions & 0 deletions examples/models/sklearn_iris_jsondata/IrisClassifier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from sklearn.externals import joblib
import sys

def eprint(*args, **kwargs):
print(*args, file=sys.stderr, **kwargs)

class IrisClassifier(object):

def __init__(self):
self.model = joblib.load('IrisClassifier.sav')

def predict(self,X,features_names):
eprint("--------------------")
eprint("Input dict")
eprint(X)
eprint("--------------------")
ndarray = X["some_data"]["some_ndarray"]
return self.model.predict_proba(ndarray)

2 changes: 2 additions & 0 deletions examples/models/sklearn_iris_jsondata/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scikit-learn==0.19.0
scipy==0.18.1
Loading

0 comments on commit 32de461

Please sign in to comment.