ndvhareesh commited on
Commit
d5d9b42
1 Parent(s): 1a05ce8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -1,3 +1,25 @@
1
- import gradio as gr
 
2
 
3
- gr.Interface.load("models/ndvhareesh/bart").launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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="ndvhareesh/bart")
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.")