Hello,
I try to deploy my web app with a prediction using data from a fil X.pkl. My script and this file working correctly in local host, prediction iss working too. But in streamlit cloud, it’s not possible to load my file .pkl !! I have always the same error :
" Collecting usage statistics. To deactivate, set browser.gatherUsageStats to False.
2023-09-26 21:00:11.881 Uncaught app exception
Traceback (most recent call last):
File “/home/adminuser/venv/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 565, in _run_script
exec(code, module.__dict__)
File “/mount/src/scoring_model/notebook/Streamlit/pages/1_Analyse_.py”, line 96, in
X, X_test = load_data()
File “/mount/src/scoring_model/notebook/Streamlit/pages/1_Analyse_.py”, line 91, in load_data
X = joblib.load('../X.pkl')
File “/home/adminuser/venv/lib/python3.9/site-packages/joblib/numpy_pickle.py”, line 650, in load
with open(filename, 'rb') as f:
FileNotFoundError: [Errno 2] No such file or directory: ‘…/X.pkl’ "
my repo here
The file that load X.pkl is in notebook → streamlit → pages → 1_Analyse.py.
The function in this script to load pkl files is :
def load_data():
X = joblib.load(‘…/X.pkl’)
X_test = joblib.load(‘…/X_test.pkl’)
return X, X_test
Have you an idea how to fixe it please ?
Thank you