KomalDahiya commited on
Commit
00bb000
Β·
verified Β·
1 Parent(s): 603d5ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -9
app.py CHANGED
@@ -2,23 +2,26 @@ import streamlit as st
2
  from transformers import pipeline
3
 
4
  # 🧠 Set up the page
5
- st.set_page_config(page_title="Smart Summarizer", layout="wide")
6
 
7
  # πŸ”„ Load summarizer model
8
  @st.cache_resource
 
 
 
 
 
 
 
 
9
  def load_model():
10
- return pipeline(
11
- "summarization",
12
- model="knkarthick/MEETING_SUMMARY",
13
- tokenizer="knkarthick/MEETING_SUMMARY",
14
- truncation=True
15
- )
16
 
17
  summarizer = load_model()
18
 
19
  # 🎨 Title and Subtitle
20
  st.markdown("<h1 style='text-align: center;'>LLM- Powered Text Summarizer</h1>", unsafe_allow_html=True)
21
- st.markdown("<p style='text-align: center; color: gray;'>This app summarizes large texts efficiently using a lightweight model suited for Hugging Face CPU Spaces.</p>", unsafe_allow_html=True)
22
 
23
  # πŸ”² Two-column layout
24
  col1, col2 = st.columns(2)
@@ -50,7 +53,7 @@ if st.button("πŸ” Summarize Now"):
50
  result = output[0]['summary_text']
51
  summary_output.text_area("Summary Result", value=result, height=400, label_visibility="collapsed")
52
  except Exception as e:
53
- st.error(f"⚠️ Error generating summary: {e}")
54
 
55
  # πŸ‘£ Footer
56
  #st.markdown("""
 
2
  from transformers import pipeline
3
 
4
  # 🧠 Set up the page
5
+ st.set_page_config(page_title="Text Summarizer", layout="wide")
6
 
7
  # πŸ”„ Load summarizer model
8
  @st.cache_resource
9
+ #def load_model():
10
+ #return pipeline(
11
+ #"summarization",
12
+ #model="knkarthick/MEETING_SUMMARY",
13
+ #tokenizer="knkarthick/MEETING_SUMMARY",
14
+ #truncation=True
15
+ #)
16
+
17
  def load_model():
18
+ return pipeline("summarization", model="facebook/bart-large-cnn")
 
 
 
 
 
19
 
20
  summarizer = load_model()
21
 
22
  # 🎨 Title and Subtitle
23
  st.markdown("<h1 style='text-align: center;'>LLM- Powered Text Summarizer</h1>", unsafe_allow_html=True)
24
+ #st.markdown("<p style='text-align: center; color: gray;'>This app summarizes large texts efficiently using a lightweight model suited for Hugging Face CPU Spaces.</p>", unsafe_allow_html=True)
25
 
26
  # πŸ”² Two-column layout
27
  col1, col2 = st.columns(2)
 
53
  result = output[0]['summary_text']
54
  summary_output.text_area("Summary Result", value=result, height=400, label_visibility="collapsed")
55
  except Exception as e:
56
+ st.error(f"Error generating summary: {e}")
57
 
58
  # πŸ‘£ Footer
59
  #st.markdown("""