File size: 614 Bytes
75c1cb1
 
 
03011c9
 
75c1cb1
03011c9
 
 
75c1cb1
03011c9
75c1cb1
03011c9
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import streamlit as st
from transformers import pipeline

# Set page title
st.set_page_config(page_title="Text Summarizer", layout="centered")

# Title and input
st.title("📝 Text Summarizer using BART")
text = st.text_area("Enter the text you want to summarize:", height=300)

# When button clicked
if st.button("Summarize"):
    with st.spinner("Generating summary..."):
        summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
        summary = summarizer(text, max_length=130, min_length=30, do_sample=False)
        st.success("Summary:")
        st.write(summary[0]['summary_text'])