MyFirstSpace / app.py
ricardo-lsantos's picture
Added Footer. Changed the output to clear text instead of object printing
486ac61
raw
history blame
681 Bytes
import streamlit as st
from transformers import pipeline
def getPipeline():
return pipeline("summarization")
def btnSummarizeAction(text):
summarizer = getPipeline()
output = summarizer(text)
st.write("# Summary")
st.write(output[0]['summary_text'])
def app():
st.title("Summarization App")
st.write("This is my first app using the Hugging Face transformers library.")
text = st.text_area('Text to summarize', 'Enter text here...')
if st.button('Summarize'):
if text is not None:
btnSummarizeAction(text)
else:
st.write("Please enter some text to summarize")
if __name__ == "__main__":
app()