luisotorres commited on
Commit
67d23d6
1 Parent(s): ad959f3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -0
app.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Instantiating summarization pipeline with the bart-finetuned-samsum model
5
+ summarizer = pipeline(task="summarization", model="luisotorres/bart-finetuned-samsum")
6
+
7
+ # Title
8
+ st.title("📝 Text Summarization with BART Model")
9
+
10
+ # Create a sidebar for input
11
+ with st.sidebar:
12
+ st.header("Input")
13
+ input_text = st.text_area("Enter text for Summarization:")
14
+
15
+ # Create a button to start the summarization
16
+ if st.button("Summarize"):
17
+ # If the input box isn't empty, process the input and generate a summary
18
+ if input_text:
19
+ summary = summarizer(input_text, max_length=1024, min_length=0, do_sample=False)
20
+ st.subheader("Summary")
21
+ st.write(summary[0]["summary_text"])
22
+ else:
23
+ st.warning("Enter text for summarization.")