Spaces:
Runtime error
Runtime error
File size: 930 Bytes
867afc2 a69a6d2 d1777a1 a69a6d2 dfdd890 867afc2 dfdd890 867afc2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import streamlit as st
from transformers import pipeline
def summarizeText(summarizer, txt):
summarized_text = summarizer(txt, max_length=100)[0]["summary_text"]
return summarized_text
@st.cache_resource
def load_summarizer():
return pipeline("summarization", model = "jasonsurya0/BART_TWELVE")
def main():
st.set_page_config(page_title="Automatic Text Summarizer With BART")
# BART MODEL DEVELOPED
summarizer = load_summarizer()
# ----HEADER
st.subheader("Text Summarizer Built With BART")
#-----Text Area
txt = st.text_area('Input Text to Summarize', '''
Amanda: I baked cookies. Do you want some?
Jerry: Sure!
Amanda: I'll bring you tomorrow :-)
''', height = 180)
if st.button('Summarize'):
# st.write("TEST")
st.text_area('Summarized Text', summarizeText(summarizer, txt), height = 140)
if __name__=="__main__":
main() |