Python code works fine when run in computer but does not when pushed to streamlit

Hello,
I have an ML model that was saved as a pickle in the local computer ā€œmodel.pklā€
However, when I try to apply this model on new data, it gives me 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

Doest anyone know what could be the problem?

You cannot access files on your local computer when running on streamlit cloud.

I tried also by putting everything on github, my code and the model. I load my model like this:
model_from_joblib = joblib.load(ā€˜default_class_model.pklā€™)
Where ā€˜default_class_model.pklā€™ is also inside my Github repository. I get the same error. Is this having to do with how I am loading ā€˜default_class_model.jsonā€™? how should I load it otherwise?
Thanks

I can only guessā€¦
Probably you are using too old xgboost version (1.1.0) , since support for JSON was introduced in xgboost version 1.3
Can you share your github repo link?

Hi Franky,

I checked and I trained my model is in the latest xgboost version. I also made sure to deploy the app on the latest python version 3.9 (although my model is trained on 3.10 )

FYI the code does not contain the training part
https://github.com/marcebejarano/classification

But in your requirements.txt file you have in general quite old library versions, for example:

xgboost==1.1.1

You were right! Thank you so much!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.