Suhaib-27 commited on
Commit
6e5c5c1
1 Parent(s): 7280d2e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -6
app.py CHANGED
@@ -1,9 +1,23 @@
1
- import streamlit as st
2
  from transformers import pipeline
3
 
4
- # get the topic
5
- topic = st.text_area("Enter text to be summarized")
6
 
7
- if topic:
8
- summarizer = pipeline("summarization", model = "google-t5/t5-base")
9
- st.json(summarizer)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
  from transformers import pipeline
3
 
4
+ # Load the summarization pipeline from Hugging Face
5
+ summarizer = pipeline("summarization", model="sshleifer/distilbart-cnn-12-6")
6
 
7
+ # Streamlit interface
8
+ st.title("Text Summarization App")
9
+
10
+ # Text input
11
+ input_text = st.text_area("Enter the text to summarize:", height=200)
12
+
13
+ if st.button("Summarize"):
14
+ if input_text:
15
+ # Summarize the text
16
+ summary = summarizer(input_text, max_length=50, min_length=25, do_sample=False)
17
+ summarized_text = summary[0]['summary_text']
18
+
19
+ # Display the summary
20
+ st.subheader("Summary")
21
+ st.write(summarized_text)
22
+ else:
23
+ st.error("Please enter some text to summarize.")