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="🚨")