I want to know which is the path of my .py

I have a repo created in GitHub already, with some folders, in one of these is my .py, the one is executing by streamlit.

Now, I tried to deploy the app and everything is good till, show up this error.

2023-02-15 12:56:59.338 Uncaught app exception

Traceback (most recent call last):

  File "/home/appuser/venv/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 565, in _run_script

    exec(code, module.__dict__)

  File "/app/startup-predictions/streamlit/proyecto.py", line 15, in <module>

    with open('model_miguel_recall.pkl', 'rb') as re:

FileNotFoundError: [Errno 2] No such file or directory: 'model_miguel_recall.pkl'

when I tried on my host, it work properly, cause this pkl is in the same path of .py, so the path has been written correctly.

I will appreciate some help.

Thanks

Please share a link to your public github repo, so that we can have a look at your file structure.

1 Like

Prepend streamlit/ to the paths in 1, 2, 3.

E.g. with open('streamlit/model_miguel_recall.pkl', 'rb') as re:.

Also either comment out this line or upload that image to your repo.

Once you make those changes, your app should successfully load the model:

2 Likes

Thanks a lot, @snehankekre.

It is running great.

Have a good day