New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TQDM-style progress bar #160
Comments
The current progress widget, as you mentioned, feels too low level for everyday use. Here's a minimum implementation that would capture the desirable level of abstraction. The nice thing about
|
The problem I have now is that the written title coming from |
I think the modification of using the placeholders Changing def __init__(self, iterable, title=None):
if title:
st.write(title)
self.prog_bar = st.progress(0) to def __init__(self, iterable, title=None):
if title:
st_title.write(title)
self.prog_bar = st_progress_bar.progress(0)
and adding st_title = st.empty() # add this at top
st_progress = st.empty() # add this at top full code below:import streamlit as st
import time
st_title = st.empty()
st_progress_bar = st.empty()
class tqdm:
def __init__(self, iterable, title=None):
if title:
st_title.write(title)
self.prog_bar = st_progress_bar.progress(0)
self.iterable = iterable
self.length = len(iterable)
self.i = 0
def __iter__(self):
for obj in self.iterable:
yield obj
self.i += 1
current_prog = self.i / self.length
self.prog_bar.progress(current_prog)
for i in tqdm(range(200), title='tqdm style progress bar'):
time.sleep(0.05)
st_title.empty()
st_progress_bar.empty()
st.balloons() |
I think you may be interested in stqdm :
This takes the best from tqdm & streamlit to :
Upcoming features :
|
@Wirg, is it compatible with pandas.apply inside streamlit? |
@AndreyGurevich do you mean the progress_apply from tqdm ? |
Yes |
@AndreyGurevich Yes, it works. Stqdm inherits from tqdm. from time import sleep
import pandas as pd
from stqdm import stqdm
stqdm.pandas()
pd.Series(range(50)).progress_map(lambda x: sleep(1)) @andfanilo Thanks. Sure. Where should I ? |
@Wirg Oops I failed at copying the correct link to the forum XD here it is! |
@Wirg great, thank you! |
This is great! Could we release this as a component for the components gallery? |
Thank you for your advice and support.
Is this something else that what I already did ? |
Closing, as this now exists as a Streamlit component! |
Problem
The
st.progress
API is quite low level:Solution
MVP
It would be great if we had another primitive that behaved like tqdm, with a similar (or identical?) API.
Possible additions
Should we make a special widget for this?
The text was updated successfully, but these errors were encountered: