Error with cache

Hi,

I’m a student. I’m currently working on a NLP project on my own. Streamlit definitely makes it easy to deploy apps. This is my second app which I’m working on.
This time, I’m having some trouble with the cache functionality. I understand we can only cache few types of object. But since we can cache a particular data set, that’s what I’m trying. Although my application throws an error on a completely different part.

So I first want to do a few cleaning steps depending on the inputs from select box. This works perfectly fine. The function is cached. Then I take this data to make a wordcloud and sentiment graph. So far so good. Later I take input from a slider to get the number of topics. When I click the button, a LDA model is trained to get the topics. Without the cache function on the cleaning function (which has no connection to the LDA), it works fine. But with the function, I get this error -

streamlit.hashing.InternalHashError: module ‘main’ has no attribute ‘file

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

Help with the same would be really appreciated.