Error when loading the pkl file

Hi,
I am using streamlit cloud and when deploying and on the time of making prediction, it is not able to load .pkl file,
FileNotFoundError: This app has encountered an error. The original error message is redacted to prevent data leaks. Full error details have been recorded in the logs (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/appuser/venv/lib/python3.8/site-packages/streamlit/scriptrunner/script_runner.py", line 443, in _run_script
    exec(code, module.__dict__)File "/app/zenfiles/customer_satisfaction/streamlit_app.py", line 48, in <module>
    main()File "/app/zenfiles/customer_satisfaction/streamlit_app.py", line 31, in main
    with open('model.pkl', 'rb') as handle:

I have repo here:- GitHub - ayush714/zenfiles at zenfiles2/customer-satisfaction
in streamlit__app.py file

so let me know how I can fix this?

Hey @Ayush_Singh

Welcome to the streamlit community :tada: :tada:

You need to change the path of the pickle file in order to fix this.
So the line with open('model.pkl', 'rb') as handle:
will change to with open('customer_satisfaction/model.pkl', 'rb') as handle:.

Best,
Kanak

2 Likes