Spaces:
Sleeping
Sleeping
# -*- coding:utf-8 -*- | |
import streamlit as st | |
def st_pb(method): | |
def progress_bar(ref): | |
container = st.empty() | |
bar = st.progress(0) | |
pg_gen = method(ref) | |
try: | |
while True: | |
progress = next(pg_gen) | |
bar.progress(progress[0]) | |
if progress[2]: | |
container.write("β Processing... " + progress[1]) | |
else: | |
container.write("βοΈ Errror with..." + progress[1]) | |
except StopIteration as result: | |
return result.value | |
return progress_bar | |