File size: 544 Bytes
5d4054c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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)