Spaces:
Sleeping
Sleeping
muthumk3108
commited on
Commit
β’
eb8c9ad
1
Parent(s):
8e045bc
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,25 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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")
|
9 |
+
|
10 |
+
# Creating a sidebar for input
|
11 |
+
with st.sidebar:
|
12 |
+
st.header("Input")
|
13 |
+
input_text = st.text_area("Enter a text or dialogue for summarization.")
|
14 |
+
|
15 |
+
# Creating 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("Original Text")
|
21 |
+
st.write(input_text)
|
22 |
+
st.subheader("Summary")
|
23 |
+
st.write(summary[0]["summary_text"])
|
24 |
+
else:
|
25 |
+
st.warning("Enter a text or dialogue for summarization.")
|