blazingbunny
commited on
Commit
·
1457f73
1
Parent(s):
724a5a1
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
from
|
3 |
-
from pprint import pprint
|
4 |
|
5 |
st.title('BERT Summarizer')
|
6 |
uploaded_file = st.file_uploader("Choose a text file", type="txt")
|
@@ -10,7 +9,6 @@ if uploaded_file is not None:
|
|
10 |
data = data.replace('\n', '')
|
11 |
data = data.replace("\ufeff", "")
|
12 |
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
st.write(summarized_text)
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import pipeline
|
|
|
3 |
|
4 |
st.title('BERT Summarizer')
|
5 |
uploaded_file = st.file_uploader("Choose a text file", type="txt")
|
|
|
9 |
data = data.replace('\n', '')
|
10 |
data = data.replace("\ufeff", "")
|
11 |
|
12 |
+
summarizer = pipeline("summarization")
|
13 |
+
summarized = summarizer(data[:1024]) # BERT has a max token limit
|
14 |
+
st.write(summarized[0]['summary_text'])
|
|