File size: 1,048 Bytes
5d9d1d0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st
from transformers import pipeline

# Load the summarization pipeline
text_summary = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")

def summarize_text(input_text):
    output = text_summary(input_text)
    return output[0]['summary_text']

def run():
    st.title("πŸ“„ Text Summary Tool")
    st.write("This tool helps you summarize long pieces of text efficiently using AI-powered NLP models.")

    st.write("Enter a large text below to generate a summary.")
    text = st.text_area("This tool helps you summarize long pieces of text efficiently using AI-powered NLP models.")

    # text = st.text_area("Enter your text here:", "")
    if st.button("πŸš€ Summarize", help="Click to generate summary"):
        if text:
            with st.spinner("Generating summary..."):
                summary_result = summarize_text(text)

            st.markdown("### πŸ“ Summarized Text:")
            st.success(summary_result)
        else:
            st.warning("⚠️ Please enter some text to summarize.")