It seems that streamlit.write()
and streamlit.text()
both display the given text starting on a new line. Is there any way to display several pieces of strings on the same line incrementally?
E.g. say I want to build a text generation demo where the model takes ~1 second to generate one word, instead of running the model for tens of seconds and only show the full output at the end, I’d like to instantly print out the word generated every second, but on the same line. Ideally something like
word = model.generate_next_word( '<|start|>')
while word != '<|end|>':
streamlit.text_on_same_line(word + ' ') # need to incrementally display a new word at every step
word = model.generate_next_word(word)