text-summarizer / app.py
luckysoni10's picture
Create app.py
2417bab verified
import streamlit as staticmethod
from transformers import pipeline
sumarizer = pipeline("summarization", model="sshleifer/distibart-cnn-12-6")
st.title("Text Summarizer")
st.write("Enter any long text and get a short summary instantly!")
input_text = st.text_area("Enter your text below:", height=300)
if st.button("summarize"):
if input_text.strip() != "":
with st.spinner("summarizing..."):
summary = summarizer(input_text, max_length=150, min_length=30, do_sample=False)
st.subheader("summary:")
st.success(summary[0]['summary_text'])
else:
st.warning("Please enter some text to summarize.")