Chris-lab / pages /arena.py
kz209
initialize
9a1ab03
raw
history blame
600 Bytes
import sys
from concurrent.futures import ThreadPoolExecutor
import streamlit as st
from streamlit.runtime.scriptrunner.script_run_context import \
get_script_run_ctx
sys.path.append(".") # Add parent directory to Python path
from utils.multiple_stream import stream_data_in_column
if st.button("Stream data"):
# Define layout
columns = st.columns(2)
# Submit concurrent tasks
with ThreadPoolExecutor(max_workers=2) as executor:
ctx = get_script_run_ctx()
futures = [
executor.submit(stream_data_in_column, col, ctx) for col in columns
]