'Deploying ML model on Streamlit

I have a code that basically takes in a csv, which can be uploaded from streamlit and then pushes out a classification prediction.

Just as a context I use xgboost to create my model and I save it as following:

joblib.dump(model, 'C:\\Users\myname\classification\default_class_model.pkl')

To grab the model I do:

model_from_joblib =joblib.load('C:\\Users\myname\classification\default_class_model.pkl')
scoring = model_from_joblib.predict(X_test)

When I execute it in Jupyter notebooks it seems to work just fine, but when running on anaconda and do streamlit run mymodel.py

I get the error:

XGBoostError: [13:38:10] C:\Users\Administrator\workspace\xgboost-win64_release_1.1.0\include\xgboost/json.h:65: Invalid cast, from Null to Array

Does anyone have an idea why this may be?



Solution 1:[1]

I solved the problem by updating the xgboost version I was using

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Marcela Bejarano