sabre-code's picture
Added app.py
58d8dc0
raw
history blame
No virus
931 Bytes
import streamlit as st
from transformers import pipeline
st.title("Text Summarization App |PEGASUS-Large|) ")
# Create a text input widget
text_input = st.text_area(label="Input Text", height=200)
# Define a function to generate the summary
def generate_summary(text):
summarizer = pipeline("summarization", model="sabre-code/pegasus-large-cnn-dailymail")
generated_summary = summarizer(text)
# Return the generated summary
return generated_summary
# Add a button to trigger the generation of the summary
generate_button = st.button(label="Generate Summary")
if generate_button:
# Call the generate_summary function when the button is clicked
generated_summary = generate_summary(text_input.value)
st.success("Summary Generated!")
else:
st.warning("Please enter some text in the input field above.")
# Display the generated summary
st.markdown("# Summary")
st.code(generated_summary)