I have an streamlit app that I use as a labeling tool.
The user gets a list of many small dataframes with a checkbox each and a submit button at the end of the form to submit the labels.
When I use st.write to write the dataframes to the browser, the browser has serious performance issues (100% cpu usage on one core that does not go away). The server side script has no performance problems.
When I use the AgGrid Component instead of st.write to write the dataframes, then I don’t see this issue.
Just wanted to let you guys know about this.
sadly not yet, I tried to make a demo for this but for a tiny app it always works.
I do have some pretty big dataframes and figures in my big app (close to the maximum size), possibly this creates some kind of timing issue somewhere.
I will try again to create an example tomorrow.
I was able to build a small example now. Apparently the streamlit dataframe causes a high cpu load when the checkboxes are clicked, probably due to layout changes and redraws which the Agrid component does not suffer from.
import streamlit as st
st.set_page_config(layout="wide")
import pandas as pd
from st_aggrid import AgGrid, GridOptionsBuilder
s = pd.Series(list('abcganlwnfneowb'))
df = pd.get_dummies(s)
with st.form("test"):
for i in range(30):
st.checkbox(label="test", key=i)
st.write(df)
#gb = GridOptionsBuilder.from_dataframe(df)
#AgGrid(df, gridOptions=gb.build(), key=f"grid{i}")
if st.form_submit_button("submit"):
st.info("submitted")
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.