|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
summarizer = pipeline("summarization") |
|
|
|
|
|
st.title("Text Summarization App") |
|
st.write("Enter text below to get a summary.") |
|
|
|
|
|
input_text = st.text_area("Input Text", height=300) |
|
|
|
|
|
if st.button("Summarize"): |
|
if input_text.strip(): |
|
with st.spinner("Summarizing..."): |
|
|
|
summary = summarizer(input_text, max_length=130, min_length=30, do_sample=False) |
|
st.success("Summary complete!") |
|
st.write("**Summary:**") |
|
st.write(summary[0]['summary_text']) |
|
else: |
|
st.warning("Please enter some text to summarize.") |
|
|