I just updated the new uploader and now I get an error I did not get before when I try to pass my uploaded csv file to a cached function.
I looked at the documentation of the file uploader and tried to convert the uploaded object in something else with StringIO(uploaded_file.decode(“utf-8”)) and with text_io = io.TextIOWrapper(uploaded_file) but I still get the caching error.
I assume I need to add something to my cache function. I have tried @st.cache(hash_funcs={StringIO: StringIO.getvalue}) and others but it does not work.
Being trying to solve this for some time. Help is really appreciated Great product!
I am still having difficulties using the cache with the new file uploader. This must be really easy but I am stuck since three days…
I have a function that allows the user to either choose a local file or upload her own.
This function passes the path of the local file (if local file chosen) or the StringIO (if upload) object to a the cached function that pd.read_csv reads dataset into a dataframe.
When I load a local csv dataset the cache works, while when I load the file with the file uploader the cache does not work because it sees a “change” in the input. I noticed that the the “number” of the BytesIO changes, so there is a different output from the file uploader.
I take the output of the file uploader (a csv file) and transform it like so: