import streamlit as st from transformers import pipeline st.set_page_config(page_title="Smart Text Summarizer", layout="centered") st.markdown( """ """, unsafe_allow_html=True ) # Centered title and subtitle st.markdown( """

Smart Text Summarizer 🧠

Generate concise and clear summaries with fine-tuned T5 models

""", unsafe_allow_html=True ) # Model selection keys (simple) model_options = { "T5-Small": "NeonSamurai/summarization_t5_small_v2", "T5-Base": "NeonSamurai/summarization_cnndaily_t5_base" } model_choice_key = st.selectbox("Choose a model:", list(model_options.keys())) model_name = model_options[model_choice_key] @st.cache_resource def load_pipeline(model_name): return pipeline( "text2text-generation", model=model_name, tokenizer=model_name, max_length=256, # fixed max length min_length=60, truncation=True, do_sample=False ) summarizer = load_pipeline(model_name) st.subheader("📄 Enter the text to summarize:") input_text = st.text_area("", height=300, placeholder="Paste or type your text here...") if st.button("✨ Generate Summary"): if not input_text.strip(): st.warning("Please enter some text before summarizing.") else: with st.spinner("Summarizing..."): result = summarizer("summarize: " + input_text) summary = result[0]["generated_text"] st.subheader("🧾 Summary Result") st.success(summary.strip()) # Background-Image st.markdown( """ """, unsafe_allow_html=True ) # Footer message st.markdown( """ """, unsafe_allow_html=True )