import streamlit as st from transformers import pipeline def main(): st.title("Text Summarization") # Initialize the summarizer pipeline summarizer = pipeline( task="summarization", model="facebook/bart-large-cnn", # Using a different model for better summarization min_length=50, # Increased minimum length to capture more details max_length=150, # Adjusted max length to allow for more detailed summaries truncation=True, ) # User input input_text = st.text_area("Enter the text you want to summarize:", height=200) # Summarize button if st.button("Summarize"): if input_text: # Generate the summary output = summarizer(input_text, max_length=150, min_length=50, do_sample=False) summary = output[0]['summary_text'] # Display the summary as bullet points st.subheader("Summary:") bullet_points = summary.split(". ") for point in bullet_points: st.write(f"- {point.strip()}") else: st.warning("Please enter text to summarize.") if __name__ == "__main__": main()