InternalHashError: how to make Streamlit able to hash unsupported objects?

Hello!

  1. I trained a flower image classifier in tensorflow and keras and then saved the model as model.hdf4 in google collab.

  2. Then I created a web application using streamlit. The saved model.hdf4 is loaded and executed.

and got a HashError.

InternalHashError: module โ€˜mainโ€™ has no attribute โ€˜fileโ€™

While caching the body of load_model(), Streamlit encountered an
object of type builtins.function, which it does not know how to hash.

In this specific case, itโ€™s very likely you found a Streamlit bug so please
[file a bug report here.]
(https://github.com/streamlit/streamlit/issues/new/choose)

In the meantime, you can try bypassing this error by registering a custom
hash function via the hash_funcs keyword in @st.cache(). For example:

Does anyone knows how to make Streamlit able to hash this objects?

thank you!