abstractive / app.py
Safna's picture
Create app.py
e27c01d
raw
history blame
869 Bytes
import streamlit as st
from transformers import pipeline
model_name = "Safna/abstractive"
summarizer = pipeline("summarization", model= AutoModelForSeq2SeqLM.from_pretrained(model_name), tokenizer= AutoTokenizer.from_pretrained("sshleifer/distilbart-xsum-12-3"))
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.")