Streamlit app failes to load weights

Hello!

This is my first app in streamlit. I trained a model to segment images. I used keras 2 to save the weights of model. Then, I achieved deploy my model in streamlit in my local computer (without errors).

But, I have tried to deploy the same model as app in https://share.streamlit.io/, but, I have the next error:
“Keras 3 only supports V3 .keras and .weights.h5 files, or legacy V1/V2 .h5 files.”

My files are:
weights.data-00000-of-00001
weights.index
checkpoint

To load the weigths, I used:
import tensorflow as tf
unet.load_weights(‘weights’)

My requirement file is:
matplotlib
numpy
Pillow
scipy
opencv-python-headless
pytube
ipython
streamlit
tensorflow
keras

Please, do you have some idea how I can to load the weights of my model?

Thank you!

Hi @Artificial_Intellige

Have you try specifying the same version number for tensorflow that you used locally with that used on the cloud?

You can do:

pip list

to figure out which specific version that you’re using and specify that in the requirements.txt file.

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