File size: 660 Bytes
2417bab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import streamlit as staticmethod
from transformers import pipeline

sumarizer = pipeline("summarization", model="sshleifer/distibart-cnn-12-6")

st.title("Text Summarizer")
st.write("Enter any long text and get a short summary instantly!")

input_text = st.text_area("Enter your text below:", height=300)

if st.button("summarize"):
    if input_text.strip() != "":
        with st.spinner("summarizing..."):
            summary = summarizer(input_text, max_length=150, min_length=30, do_sample=False)
            st.subheader("summary:")
            st.success(summary[0]['summary_text'])
    else:
        st.warning("Please enter some text to summarize.")