hardik90 commited on
Commit
4f476af
·
verified ·
1 Parent(s): 4c235c9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Load summarization model
5
+ summarizer = pipeline("summarization", model="facebook/bart-large-cnn")
6
+
7
+ # Streamlit App
8
+ st.title("Summarization App")
9
+
10
+ # Input text area
11
+ article = st.text_area("Enter the article:", ARTICLE, height=300)
12
+
13
+ if st.button("Generate Summary"):
14
+ # Generate summary using the summarizer pipeline
15
+ summary_result = summarizer(article, max_length=130, min_length=30, do_sample=False)
16
+
17
+ # Extract the summary text
18
+ summary_text = summary_result[0]['summary_text']
19
+
20
+ # Display the summary
21
+ st.subheader("Summary:")
22
+ st.write(summary_text)