Commit
·
2e9079e
1
Parent(s):
7b5d303
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,14 +1,13 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
-
st.title('BERT Summarizer')
|
| 5 |
-
uploaded_file = st.file_uploader("Choose a
|
| 6 |
|
| 7 |
if uploaded_file is not None:
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
st.write(summarized[0]['summary_text'])
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
from transformers import pipeline
|
| 3 |
|
| 4 |
+
st.title('Hugging Face BERT Summarizer')
|
| 5 |
+
uploaded_file = st.file_uploader("Choose a .txt file", type="txt")
|
| 6 |
|
| 7 |
if uploaded_file is not None:
|
| 8 |
+
user_input = uploaded_file.read().decode('utf-8')
|
| 9 |
+
if st.button('Summarize'):
|
| 10 |
+
summarizer = pipeline('summarization')
|
| 11 |
+
summarized = summarizer(user_input, max_length=130, min_length=30, do_sample=False)
|
| 12 |
+
summarized_text = summarized[0]['summary_text']
|
| 13 |
+
st.text_area('Summarized Text', summarized_text, height=200)
|
|
|