Hi Streamlit community!
It has been amazing journey for me personally to use streamlit on learning how to code.
However, I have encountered a problem. My script will run too slow (almost a minute) when I have multiple def function. I have tried using @st.cache (it helps a lot in reducing run time), however my script still run above 40 seconds.
I believe that the problem is because the def function is running consecutively from top to bottom. Is there any way I can run multiple functions at the same time while using the @st.cache? (Because I have used multiprocessing and thread, it seems it does not work along with
Below code is just an example of what I am doing. Thank you.
import streamlit as st from requests import get, post address1 = "aa" address2 = "bb" address3 = "cc" @st.cache def get_balance(address): data = response.json() value = int(data) return value @st.cache def get_balance2(address): data = response.json() value = int(data) return value @st.cache def get_balance3(address): data = response.json() value = int(data) return value data1 = def get_balance(address1) data2 = def get_balance2(address2) data3 = def get_balance3(address3) st.text(data1) st.text(data2) st.text(data3)