File size: 681 Bytes
fadb965
2221ec2
486ac61
 
 
 
 
 
2221ec2
 
486ac61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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()