FileNotFoundError pickle file

Hi,
My project here https://share.streamlit.io/damienld/rakuteam/main/Streamlit_rakuten/demo_rakuten.py works perfectly locall under a virtual environment with python 3.8.
But when I upload it here it says
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.
File “/app/rakuteam/Streamlit_rakuten/creation_features.py”, line 28, in load_keywords_fromfile
with open(‘dico_keywords_tfidf_15.pkl’, ‘rb’) as handle:

How Can I check if my file’dico_keywords_tfidf_15.pkl’ was correctly uploaded? Is it a problem with pickle (but I don’t have any issue locally …)
Thans

Did you upload dico_keywords_tfidf_15.pkl in your github repo?

If you use with open(‘dico_keywords_tfidf_15.pkl’, ‘rb’) as handle:, then dico_keywords_tfidf_15.pkl should be in the relative path of where creation_features.py is.
Please share the repo if you still struggle.

The app is [demo_rakuten.py] and the .pkl is in the same directory
Thanks!

Could anyone help on this please? Thanks

Hi @Dam1006, :wave:

Welcome to the community! :partying_face:

  1. Change the filepath to the pickle file on line 28 of creation_features.py to:
with open('Streamlit_rakuten/dico_keywords_tfidf_15.pkl', 'rb') as handle: 
  1. Also, replace opencv-python==4.5.3.56 with opencv-python-headless==4.5.3.56 to avoid:

    ImportError: libGL.so.1: cannot open shared object file: No such file or directory
    
  2. Go through all your Python scripts and make sure to prepend Streamlit_rakuten/ to the paths of any files you open in them and just ensure you have the correct filepaths. e.g. Cnnimage_predict("Streamlit_rakuten/test2.jpg")

Best, :balloon:
Snehan

Thanks Snehan! It s much better but I have another issue how do I manage a file which is managed by GIT LFS (because it s 225Mo) ?
Thanks