This error has been constant since deployment, and now I’m very confused at this point because I can’t really figure out what is the actual issue here.
It seems that the issue is here:
File “/home/appuser/venv/lib/python3.9/site-packages/streamlit/scriptrunner/script_runner.py”, line 557, in _run_script
exec(code, module.dict)
File “st_app.py”, line 135, in
cartoon_img = cartoon_style(display_image)
File “st_app.py”, line 93, in cartoon_style
cartoon_image = cv2.stylization(image_1, sigma_s=150, sigma_r=0.25)
cv2.error: OpenCV(4.6.0) error: (-5:Bad argument) in function ‘stylization’
Odd, I just forked the repo and it deployed in Streamlit Cloud without issues. Link to app.
edit: using streamlit 1.12.2 works fine as well
edit2: without changing anything, the app now fails showing the same issue in the logs
edit3: refactored the code a little bit to reboot the app in Streamlit Cloud. It’s working again… but it might break again? I suspect the problem comes from the streamlit-image-comparison component that writes opencv images that are supposed to be temporal but are never cleaned, and possibly never released.
It’s been a couple days and the version from my fork has not failed yet. The only meaningful change was that the image processing only gets triggered when both st.button('See the Magic! 🎉') and st.file_uploader("UPLOAD AN IMAGE") evaluate to True. In the earlier version, only the st.button('See the Magic! 🎉') was checked, so if the app was run without an uploaded file, it would throw an exception.
Yes, I tried but it doesn’t seem to solve the actual issue Right now, my app is running without any issues. I’ll keep monitoring how long it works well…