import streamlit as st from transformers import pipeline # Load the summarization model summarizer = pipeline("summarization") # Streamlit app layout st.title("Text Summarization App") st.write("Enter text below to get a summary.") # Text input area for user to input text input_text = st.text_area("Input Text", height=300) # Summarize button if st.button("Summarize"): if input_text.strip(): with st.spinner("Summarizing..."): # Generate the summary summary = summarizer(input_text, max_length=130, min_length=30, do_sample=False) st.success("Summary complete!") st.write("**Summary:**") st.write(summary[0]['summary_text']) else: st.warning("Please enter some text to summarize.")