This message was deleted.
# ask-for-help
s
This message was deleted.
g
service.py: import bentoml from bentoml.io import JSON model_ref = bentoml.sklearn.get('stroke_prediction:latest') dv = model_ref.custom_objects['dicVectorizer'] model_runner = model_ref.to_runner() svc = bentoml.Service('stroke_prediction', runners=[model_runner]) @svc.api(input= JSON() , output= JSON()) def classify(application_data): vector = dv.transform(application_data) prediction = model_runner.predict_proba.run(vector) return prediction
Model save process: log_model = LogisticRegression(max_iter=1000, random_state=1,C=100,penalty='l2',solver='lbfgs') log_model.fit(x_train, y_train) bentoml.sklearn.save_model('stroke_prediction', log_model, custom_objects={ 'dicVectorizer': dv })
Solution, add this to save file: ignatures={ "predict_proba": { "batchable": True, "batch_dim": 0 }
👍 2