import streamlit as st
from transformers import pipeline
# Streamlit App
st.set_page_config(page_title="T5 FineTuning Summarizer", layout="centered")
# Load the summarization pipeline
@st.cache_resource
def load_model():
return pipeline("text2text-generation", model="trohith89/KDTS_T5_Summary_FineTune")
pipe = load_model()
# Custom CSS for styling
st.markdown("""
""", unsafe_allow_html=True)
# Headline
st.markdown('
T5 FineTuning Summarizer
', unsafe_allow_html=True)
# Text input
user_input = st.text_area("Enter your long text below:", height=300, placeholder="Paste or type your content here...")
# Summarize button
if st.button("Summarize"):
if user_input.strip():
with st.spinner("Generating summary..."):
summary = pipe(user_input, max_length=150, min_length=30, do_sample=False)[0]['generated_text']
st.subheader("📝 Summary:")
st.success(summary)
else:
st.warning("Please enter some text to summarize.")