summerizer / app.py
nxmwxm's picture
Create app.py
c34b9cf verified
raw
history blame
548 Bytes
import streamlit as st
from transformers import pipeline
# Initialize the summarization pipeline
summarizer = pipeline("summarization")
st.title("Text Summarization Tool")
st.write("Enter the text you want to summarize below:")
# Text input
text = st.text_area("Text Input", "")
if st.button("Summarize"):
if text:
summary = summarizer(text, max_length=150, min_length=30, do_sample=False)
st.write("Summary:")
st.write(summary[0]['summary_text'])
else:
st.write("Please enter some text to summarize.")