Spaces:
Runtime error
Runtime error
Download app.py from FPRT/Text_Summarizer: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/spaces/FPRT/Text_Summarizer/resolve/main/app.py
- Command line
-
hf download hf://spaces/FPRT/Text_Summarizer/app.py
-
curl -L -o app.py https://huggingface.co/spaces/FPRT/Text_Summarizer/resolve/main/app.py
813 Bytes
| 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="🚨") |