VoltIC commited on
Commit
90557f9
·
verified ·
1 Parent(s): b87262d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -5
app.py CHANGED
@@ -6,6 +6,7 @@ MODEL_ID = "VoltIC/Automated-Text-Summarizer"
6
 
7
  @st.cache_resource
8
  def load_summarizer():
 
9
  return pipeline(
10
  "summarization",
11
  model=MODEL_ID,
@@ -13,16 +14,22 @@ def load_summarizer():
13
  framework="pt"
14
  )
15
 
 
16
  summarizer = load_summarizer()
17
 
 
18
  st.title("📝 AI Text Summarizer")
19
- st.write("Your model has loaded successfully from the subfolder!")
20
 
21
- input_text = st.text_area("Paste text here...", height=300)
22
 
23
  if st.button("Summarize"):
24
  if input_text.strip():
25
- with st.spinner("Summarizing..."):
 
26
  summary = summarizer(input_text, max_length=100, min_length=30)
27
- st.success("Summary Complete!")
28
- st.write(summary[0]['summary_text'])
 
 
 
 
6
 
7
  @st.cache_resource
8
  def load_summarizer():
9
+ # Adding subfolder="summarizer_model" is the critical fix
10
  return pipeline(
11
  "summarization",
12
  model=MODEL_ID,
 
14
  framework="pt"
15
  )
16
 
17
+ # The app tries to load this FIRST
18
  summarizer = load_summarizer()
19
 
20
+ # UI starts here
21
  st.title("📝 AI Text Summarizer")
22
+ st.write("Model loaded successfully from subfolder!")
23
 
24
+ input_text = st.text_area("Paste your long text here...", height=300)
25
 
26
  if st.button("Summarize"):
27
  if input_text.strip():
28
+ with st.spinner("Processing..."):
29
+ # Set length for 2-3 sentence output
30
  summary = summarizer(input_text, max_length=100, min_length=30)
31
+ st.success("Done!")
32
+ st.subheader("Summary")
33
+ st.write(summary[0]['summary_text'])
34
+ else:
35
+ st.warning("Please enter some text.")