File size: 519 Bytes
640070d
 
2b35d4b
640070d
 
5b29666
640070d
 
 
 
 
2b35d4b
640070d
 
2b35d4b
64ad5b5
 
 
c756a23
64ad5b5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as st

st.markdown("### Very slow string inverter")
st.markdown("<img width=200px src='https://rozetked.me/images/uploads/dwoilp3BVjlE.jpg'>", 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)