import streamlit as st import transformers model = transformers.AutoModelForCausalLM.from_pretrained("distilgpt2") tokenizer = transformers.AutoTokenizer.from_pretrained("distilgpt2") user_inputed_text = st.text_input("Insert text") outputs = model.generate( **tokenizer([user_inputed_text], return_tensors='pt'), max_new_tokens=50, do_sample=True, ) outputs_text = tokenizer.decode(outputs[0]) st.text_area(label='output', value="your text is :" + user_inputed_text[::-1])