Thanks for the code example, using the selectbox for now and maybe changing it later to buttons when a new update releases is a decent fix for the moment.
One other question, if this needs to be posted in an other thread be sure to let me know.
Is it possible to use concurrent.futures.ThreadPoolExecutor in streamlit code to speed up the generating/rendering of images?
When I try to use it, i get the following error with the simple piece of code below:
error:
2020-10-15 15:24:33.471 Thread 'ThreadPoolExecutor-1_0': missing ReportContext
code:
model_col1, model_col2 = st.beta_columns(2)
ids = [str(i) for i in dat_filtered[‘id’].tolist()]
row_indexes = [i for i in range(0,len(ids))]
from itertools import repeat
def test_threadpool(id, img_combiner, model_col, model_index, row_index):
with model_col:
st.write(id)
with ThreadPoolExecutor(max_workers=12) as exec:
print('started loading images with threadpoolExe')
exec.map(test_threadpool, iter(ids),repeat(img_combiner), repeat(model_col1), repeat(0),
iter(row_indexes))
# print(f'using ids({len(ids)}): {ids} and row indexes({len(row_indexes)}: {row_indexes})')
# exec.map(show_image, iter(ids),repeat(img_combiner), repeat(model_col1), repeat(0),
iter(row_indexes))
# exec.map(show_image, iter(ids),repeat(img_combiner2), repeat(model_col2), repeat(1),
iter(row_indexes))
print('done running threadpool')
With my full code that generates the images I get no error or any output at all, nothings gets displayed either.