trohith89 commited on
Commit
5a4f5ac
·
verified ·
1 Parent(s): e039471

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +55 -0
app.py ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+
4
+ # Streamlit App
5
+ st.set_page_config(page_title="T5 FineTuning Summarizer", layout="centered")
6
+ # Load the summarization pipeline
7
+ @st.cache_resource
8
+ def load_model():
9
+ return pipeline("text2text-generation", model="trohith89/KDTS_T5_Summary_FineTune")
10
+
11
+ pipe = load_model()
12
+
13
+
14
+ # Custom CSS for styling
15
+ st.markdown("""
16
+ <style>
17
+ .main {
18
+ background-color: #f0f2f6;
19
+ }
20
+ .stTextArea textarea {
21
+ height: 300px !important;
22
+ font-size: 16px;
23
+ }
24
+ .headline {
25
+ font-size: 36px;
26
+ font-weight: bold;
27
+ text-align: center;
28
+ color: #4B8BBE;
29
+ padding: 20px;
30
+ }
31
+ .stButton>button {
32
+ background-color: #4B8BBE;
33
+ color: white;
34
+ font-size: 18px;
35
+ padding: 10px 20px;
36
+ border-radius: 8px;
37
+ }
38
+ </style>
39
+ """, unsafe_allow_html=True)
40
+
41
+ # Headline
42
+ st.markdown('<div class="headline">T5 FineTuning Summarizer</div>', unsafe_allow_html=True)
43
+
44
+ # Text input
45
+ user_input = st.text_area("Enter your long text below:", height=300, placeholder="Paste or type your content here...")
46
+
47
+ # Summarize button
48
+ if st.button("Summarize"):
49
+ if user_input.strip():
50
+ with st.spinner("Generating summary..."):
51
+ summary = pipe(user_input, max_length=150, min_length=30, do_sample=False)[0]['generated_text']
52
+ st.subheader("📝 Summary:")
53
+ st.success(summary)
54
+ else:
55
+ st.warning("Please enter some text to summarize.")