Spaces:
Running
Running
Update app.py
Browse files
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="
|
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"
|
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("""
|