blazingbunny's picture
Update app.py
1457f73
raw
history blame
462 Bytes
import streamlit as st
from transformers import pipeline
st.title('BERT Summarizer')
uploaded_file = st.file_uploader("Choose a text file", type="txt")
if uploaded_file is not None:
data = uploaded_file.read().decode('utf-8')
data = data.replace('\n', '')
data = data.replace("\ufeff", "")
summarizer = pipeline("summarization")
summarized = summarizer(data[:1024]) # BERT has a max token limit
st.write(summarized[0]['summary_text'])