|
import streamlit as st |
|
from transformers import AutoTokenizer, pipeline |
|
|
|
st.title("Text Summarization App") |
|
|
|
|
|
summarizer = pipeline("summarization", model="pszemraj/led-large-book-summary") |
|
tokenizer = AutoTokenizer.from_pretrained("pszemraj/led-large-book-summary") |
|
|
|
|
|
article = st.text_area("Enter Text to Summarize:") |
|
|
|
|
|
if st.button("Summarize"): |
|
if article: |
|
|
|
data = summarizer(article, max_length=200, min_length=180, do_sample=False) |
|
summary = data[0]["summary_text"] |
|
|
|
|
|
st.subheader("Summary:") |
|
st.write(summary) |
|
else: |
|
st.warning("Please enter some text to summarize.") |
|
|
|
|