|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
summarizer = pipeline("text2text-generation", model="Priyanka-Balivada/pegasus-samsum") |
|
|
|
|
|
st.title("📝 Text Summarization with Pegasus") |
|
|
|
|
|
with st.sidebar: |
|
st.header("Input") |
|
input_text = st.text_area("Enter a text or dialogue for summarization.") |
|
|
|
|
|
if st.button("Summarize"): |
|
|
|
if input_text: |
|
summary = summarizer(input_text, max_length=1024, min_length=0, do_sample=False) |
|
st.subheader("Original Text") |
|
st.write(input_text) |
|
st.subheader("Summary") |
|
st.write(summary[0]["summary_text"]) |
|
else: |
|
st.warning("Enter a text or dialogue for summarization.") |
|
|