summary / app.py
nimesh-p's picture
Update app.py
47c4bc7
raw
history blame contribute delete
749 Bytes
import streamlit as st
from transformers import AutoTokenizer, pipeline
st.title("Text Summarization App")
# Initialize the summarizer
summarizer = pipeline("summarization", model="pszemraj/led-large-book-summary")
tokenizer = AutoTokenizer.from_pretrained("pszemraj/led-large-book-summary")
# Input text area
article = st.text_area("Enter Text to Summarize:")
# Summarization button
if st.button("Summarize"):
if article:
# Perform summarization
data = summarizer(article, max_length=200, min_length=180, do_sample=False)
summary = data[0]["summary_text"]
# Display the summary
st.subheader("Summary:")
st.write(summary)
else:
st.warning("Please enter some text to summarize.")