import streamlit as st st.markdown("### Very slow string inverter") st.markdown("", unsafe_allow_html=True) import time from transformers import pipeline def process(text): return text[::-1] text = st.text_area("TEXT HERE") if len(text.split()) > 0: # note: this if avoids sleep during first loading time t = st.empty() for i in range(len(text) + 1): t.markdown(f"## {process(text)[0:i]}...") time.sleep(1.0)