File size: 841 Bytes
a381abb
c01c953
a381abb
e916ec8
 
c01c953
e916ec8
 
c01c953
e916ec8
 
 
 
c01c953
e916ec8
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from transformers import pipeline

# Set up the summarization pipeline
summarizer = pipeline(task="summarization", model="lidiya/bart-large-xsum-samsum")

# Title for the Streamlit app
st.title("Huggingface Summarizer App")

# Create a sidebar for input
with st.sidebar:
    st.header("Input")
    input_text = st.text_area("Enter your text to be summarized:")

# Create a button to start the summarization
if st.button("Summarize"):
    # If the input box isn't empty, process the input and generate a summary
    if input_text:
        summary = summarizer(input_text, max_length=256, min_length=0, do_sample=False)
        st.subheader("Summary")
        st.write(summary[0]["summary_text"])
    else:
        st.warning("Please enter some text to summarize.")
else:
    st.subheader("Summary will appear here...")