Am trying to deploy a computer vision model but unfortunately it throws OSError

Am trying to deploy a computer vision model but unfortunately it throws the error below; my GitHub account link is bushurumark (Levi Mark Bushuru) · GitHub and the link to the app is https://computer-vision-monkeys-species-prediction-model-cphx2vjvja9wa.streamlit.app

OSError: 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 (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)File "/mount/src/computer-vision-monkeys-species-prediction-model/App.py", line 19, in <module>
    model = tf.keras.models.load_model('model.h5')
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/keras/src/saving/saving_api.py", line 183, in load_model
    return legacy_h5_format.load_model_from_hdf5(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/keras/src/legacy/saving/legacy_h5_format.py", line 116, in load_model_from_hdf5
    f = h5py.File(filepath, mode="r")
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/h5py/_hl/files.py", line 562, in __init__
    fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "/home/adminuser/venv/lib/python3.11/site-packages/h5py/_hl/files.py", line 235, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapperFile "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapperFile "h5py/h5f.pyx", line 102, in h5py.h5f.open

Your model.h5 does not look like a valid model file.

That is my saved trained model. Please feel free to check my GitHub account and advice where necessary.

No, it’s not. Check github.

1 Like

Okay i have checked and realized that i had saved the model wrongly. After correcting this is the new error; ModuleNotFoundError: 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 (if you’re on Streamlit Cloud, click on ‘Manage app’ in the lower right of your app).

Traceback:

File "/home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 535, in _run_script
    exec(code, module.__dict__)File "/mount/src/computer-vision-monkeys-species-prediction-model/App.py", line 23, in <module>
    import gdown

Looks like something went wrong when installing gdown. Look for related messages in the logs.

Thank you a lot . I checked and found out that there was issue with loading of my model. I corrected it and it worked.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.