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 opened in my local host correctly, but when I use my own link from streamlit I have gotten this error:
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 28, in <module>
img = Image.open('streamlit/introfoto.jpeg')
File "/home/appuser/venv/lib/python3.10/site-packages/PIL/Image.py", line 3227, in open
fp = builtins.open(filename, "rb")
But I reorganized the folder, to get not messy. This is my repo:
Because the working directory is different. In the deployment environment the working directory is the root of the repository /app/startup-predictions so the relative path to the pickled model is streamlit/model/model_miguel_recall.pkl.
The working directory is usually where the python interpreter is launched.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.