File size: 901 Bytes
e27c01d
 
 
 
e31ddec
 
f8f49f7
e31ddec
e27c01d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import streamlit as st
from transformers import pipeline


model_name = AutoModelForSeq2SeqLM.from_pretrained("Safna/abstractive")
tokenizer_name = AutoTokenizer.from_pretrained("sshleifer/distilbart-xsum-12-3")

summarizer = pipeline("summarization", model= model_name, tokenizer= tokenizer_name)


st.title("Text Summarization App")

input_text = st.text_area("Enter the text you want to summarize:")

if st.button("Generate Summary"):
    if input_text:
        with st.spinner("Generating summary..."):
            summary = summarizer(input_text, max_length=64, min_length=10, length_penalty=2.0, num_beams=4, early_stopping=True)
        st.subheader("Generated Summary:")
        st.write(summary[0]["summary_text"])

# Instructions
st.sidebar.header("Instructions")
st.sidebar.markdown("1. Enter the text you want to summarize.")
st.sidebar.markdown("2. Click the 'Generate Summary' button.")