zoya23 commited on
Commit
e57cedf
·
verified ·
1 Parent(s): 05d6626

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -0
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ st.title("Text Summarization App")
5
+
6
+ model_choice = st.selectbox("Choose a Model", ["BART", "T5", "PEGASUS"])
7
+
8
+ text_input = st.text_area("Enter text to summarize:")
9
+
10
+ if st.button("Summarize"):
11
+ if model_choice == "BART":
12
+ summarizer = pipeline("summarization", model="BART")
13
+ elif model_choice == "T5":
14
+ summarizer = pipeline("summarization", model="T5")
15
+ else:
16
+ summarizer = pipeline("summarization", model="PEGASUS")
17
+
18
+ summary = summarizer(text_input, max_length=150, min_length=40, do_sample=False)
19
+ st.subheader("Summary:")
20
+ st.write(summary[0]['summary_text'])