import streamlit as st from transformers import pipeline text_generator = pipeline("text-generation", model="gpt2") st.title("Hugging Face Transformer Text Generation App") input_text = st.text_area("Enter text for generation") if input_text: generated_text = text_generator(input_text, max_length=100, num_return_sequences=1)[0]['generated_text'] st.subheader("Generated Text:") st.write(generated_text)