Spaces:
Sleeping
Sleeping
import streamlit as st | |
from transformers import pipeline | |
# Load summarization pipeline | |
summarizer = pipeline("summarization", model="facebook/bart-large-cnn") | |
def main(): | |
st.title("Text Summarizer") | |
# Input text area | |
article = st.text_area("Enter the article:") | |
# Button to generate summary | |
if st.button("Generate Summary"): | |
# Check if the article is not empty | |
if article: | |
# Generate summary using the BART model | |
summary = summarizer(article, max_length=130, min_length=30, do_sample=False)[0]['summary_text'] | |
# Display the generated summary | |
st.subheader("Summary:") | |
st.write(summary) | |
else: | |
st.warning("Please enter an article before generating a summary.") | |
if __name__ == "__main__": | |
main() | |