import streamlit as st import time def typewriter(text: str, references: list, speed: int): tokens = text.split() container = st.empty() for index in range(len(tokens) + 1): curr_full_text = " ".join(tokens[:index]) container.markdown(curr_full_text) time.sleep(1 / speed) curr_full_text += "\n" container.markdown(curr_full_text) curr_full_text += "\n **References** \n" container.markdown(curr_full_text) curr_full_text += "\n".join(references) container.markdown(curr_full_text)