File size: 543 Bytes
161ecce
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import streamlit as st
from transformers import pipeline

# Define the summarization pipeline
hub_model_id = "VinayakMane47/mt5-small-finetuned-amazon-en-es"
summarizer = pipeline("summarization", model=hub_model_id)

# Create the Streamlit app
def main():
    st.title("Text Summarizer")
    text = st.text_area("Enter some text to summarize")
    if st.button("Summarize"):
        summary = summarizer(text, max_length=100, min_length=30, do_sample=False)[0]['summary_text']
        st.write(summary)

if __name__ == "__main__":
    main()