Can’t predict with Keras model

I have a simple binary image classification Keras model saved as an h5. It predicts fine in a normal Python session.

In Streamlit I load the model and use numpy to reshape / prepare an image for prediction the same as I do in Python. However the predict step in Streamlit keeps throwing this error:

OSError: [Errno 5] Input/output error

Traceback:

File "/usr/local/lib/python3.10/dist-packages/streamlit/scriptrunner/script_runner.py", line 557, in _run_script
    exec(code, module.__dict__)File "/var/www/mysite/app/pages/page.py", line 225, in <module>
    yhat=model.predict(img)File "/usr/local/lib/python3.10/dist-packages/keras/utils/traceback_utils.py", line 67, in error_handler
    raise e.with_traceback(filtered_tb) from NoneFile "/usr/local/lib/python3.10/dist-packages/keras/utils/io_utils.py", line 77, in print_msg
    sys.stdout.write(message)
1 Like