Reading pickle file python

Hello,
I am deploying an ML application on python onto Streamlit.
I have tested my code locally from my computer and everything seems working perfectly.
However, when deploying my code onto streamlit, I get an error when I try to load a pickle file (basically a saved ML model), which is kept in my computer so I am guessing that would be the reason… how do I get it to work?
here is my file:
model_from_joblib = joblib.load(default_class_model.pkl)

Hi @Marcela_Bejarano, welcome to the Streamlit community!

If I had to guess, I suspect that you are using a different version locally than the default on Streamlit Cloud. To set the Python version on Streamlit Cloud, please see the following:

Best,
Randy

I have been facing the same issue for days now. I have python 3.9 both locally and on streamlit.
I am in dire need of solution. Please thanks for helping

Save your model in HD5 format, not pickle. If you’re using custom objects (like loss functions), then make sure you’re serializing those too, so they can be added to the model loader when deserializing. If you’re using Keras, then the docs are good on this topic.

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