Spaces:
Sleeping
Sleeping
File size: 1,577 Bytes
5a4f5ac |
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
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("""
<style>
.main {
background-color: #f0f2f6;
}
.stTextArea textarea {
height: 300px !important;
font-size: 16px;
}
.headline {
font-size: 36px;
font-weight: bold;
text-align: center;
color: #4B8BBE;
padding: 20px;
}
.stButton>button {
background-color: #4B8BBE;
color: white;
font-size: 18px;
padding: 10px 20px;
border-radius: 8px;
}
</style>
""", unsafe_allow_html=True)
# Headline
st.markdown('<div class="headline">T5 FineTuning Summarizer</div>', 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.")
|