File size: 772 Bytes
663e8d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from transformers import pipeline

# Load the summarization model
summarizer = pipeline("summarization")

# Streamlit app layout
st.title("Text Summarization App")
st.write("Enter text below to get a summary.")

# Text input area for user to input text
input_text = st.text_area("Input Text", height=300)

# Summarize button
if st.button("Summarize"):
    if input_text.strip():
        with st.spinner("Summarizing..."):
            # Generate the summary
            summary = summarizer(input_text, max_length=130, min_length=30, do_sample=False)
            st.success("Summary complete!")
            st.write("**Summary:**")
            st.write(summary[0]['summary_text'])
    else:
        st.warning("Please enter some text to summarize.")