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


  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.]

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!