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

st.title("Text Summarization with Hugging Face")

# Choose model and set up pipeline
model_name = "t5-base"
summarizer = pipeline("summarization", model=model_name)

# Get user input
text = st.text_area("Enter some text to summarize:")

# If user has entered text, summarize it
if text:
    summary = summarizer(text, max_length=100, min_length=30, do_sample=False)
    st.write("Here is your summary:")
    st.write(summary[0]["summary_text"])