Chris-lab / utils /multiple_stream.py
kz209
initialize
9a1ab03
raw
history blame
967 Bytes
import copy
import random
from threading import currentThread
from time import sleep
import streamlit as st
from streamlit.runtime.scriptrunner.script_run_context import \
add_script_run_ctx
_TEST = """
Test of Time. A Benchmark for Evaluating LLMs on Temporal Reasoning. Large language models (LLMs) have \
showcased remarkable reasoning capabilities, yet they remain susceptible to errors, particularly in temporal \
reasoning tasks involving complex temporal logic.
"""
def generate_data_test():
"""A generator to pass to st.write_stream"""
temp = copy.deepcopy(_TEST)
l1 = temp.split()
random.shuffle(l1)
temp = ' '.join(l1)
for word in temp.split(" "):
print(word)
yield word + " "
sleep(0.1)
def stream_data_in_column(column, ctx):
"""Populate columns simultaneously"""
add_script_run_ctx(currentThread(), ctx)
print("11111111")
with column:
st.write_stream(generate_data_test)