Skip to content

Instantly share code, notes, and snippets.

@masroorhasan
Created January 13, 2019 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save masroorhasan/8816ef6a9ba56991dcfc785cbaf14d93 to your computer and use it in GitHub Desktop.
Save masroorhasan/8816ef6a9ba56991dcfc785cbaf14d93 to your computer and use it in GitHub Desktop.
import joblib
import numpy as np
class HousingGBServe(object):
def __init__(self, model_file='gb_regressor.dat'):
self.model = joblib.load(model_file)
def predict(self, X, feature_names):
prediction = self.model.predict(X)
return [[prediction.item(0), prediction.item(0)]]
if __name__ == '__main__':
serve = HousingGBServe()
print(serve.predict(np.ndarray([1, 37]), None))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment