|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
st.title("Text Summarization App |PEGASUS-Large|) ") |
|
|
|
|
|
text_input = st.text_area(label="Input Text", height=200) |
|
generated_summary = "" |
|
|
|
def generate_summary(text): |
|
summarizer = pipeline("summarization", model="sabre-code/pegasus-large-cnn-dailymail") |
|
generated_summary = summarizer(text) |
|
|
|
|
|
|
|
return generated_summary |
|
|
|
|
|
generate_button = st.button(label="Generate Summary") |
|
if generate_button: |
|
|
|
generated_summary = generate_summary(text_input.value) |
|
st.success("Summary Generated!") |
|
else: |
|
st.warning("Please enter some text in the input field above.") |
|
|
|
|
|
st.markdown("## Summary") |
|
st.code(generated_summary) |