File size: 648 Bytes
76d8eeb
 
 
 
 
 
 
 
 
 
 
5481493
76d8eeb
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st
from transformers import pipeline

t5_sum = pipeline("summarization", model= "t5-small")

# Set the title for the Streamlit app
st.title("T5 Summary Generator")

# Text input for the user
text = st.text_area("Enter your text: ")

def generate_text(dataset_sample):
    article = dataset_sample
    summary = summarizer(article, max_length=150, min_length=40, do_sample=False)
    
    return summary[0]['summary_text']

if st.button("Generate"):
    generated_text = generate_text(text)
    if generated_text:
        # Display the generated text
        st.subheader("Generated Blog Post")
        st.write(generated_text)