File size: 813 Bytes
1c65bb1
1398a8f
e2c914c
1398a8f
e2c914c
 
 
 
1398a8f
 
 
6a83f75
1398a8f
6a83f75
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import streamlit as st
from transformers import pipeline
from transformers import AutoModelForCasualLM, AutoTokenizer

tokenizer = AutoTokenizer.from_pretrained("bigscience/bloom")
model_use = AutoModelForCasualLM.from_pretrained("bigscience/bloom", device_map="auto", torch_dtype="auto",)

summarizer = pipeline('summarization', model=model_use)

st.title("Text Summarization")
st.write("""##### This demo summarizes a given text. :sunglasses:""")
text = st.text_area('Enter some text below')

result = st.button("Summarize")

with st.spinner("Generating Summary.."):
    if text and result:
        output = summarizer(text)
        st.write(output)
        st.success('Nice one, you can enter another text!', icon="✅")
        st.balloons()
    else:
        st.error("You did not enter a text", icon="🚨")