OSError: Can't read data

I am getting the below error while loading the model.

OSError: Can’t read data (file read failed: time = Tue May 18 13:14:06 2021 , filename = ‘C:/Users/Dev-Laptop/Desktop/Project_Lung_cancer/best_model_1.h5’, file descriptor = 3, errno = 13, error message = ‘Permission denied’, buf = 000001CF4C342040, total read size = 150994944, bytes this sub-read = 150994944, bytes actually read = 18446744073709551615, offset = 15239888)

Hi @Sangeeth_Lal_P_S, welcome to the Streamlit community! :wave: :slightly_smiling_face:

It would help if you share how you save and load your model and weights with TensorFlow. Nevertheless, the underlying issue is with TensorFlow / Keras and the path to your model weights.

I would suggest reading up related issues on the Keras repo and stackoverflow to see what worked for others who encountered this error. Have you tried adding .h5 as a suffix to the filepath when saving the model?

Happy Streamlit-ing! :balloon:

Thanks for your reply… It is because of my saved file corrupted…Issue solved.

1 Like

Yay, glad you found the cause and solution!

If you don’t mind sharing, how did you fix the issue? It might help other community members in the future :grinning_face_with_smiling_eyes: Did you retrain and save your model?

Best, :balloon:

Yup just retrained and saved my model again.