Commit
·
de301cb
1
Parent(s):
17ad421
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,13 @@ from transformers import pipeline
|
|
3 |
import textwrap
|
4 |
|
5 |
st.title('Hugging Face BERT Summarizer')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
uploaded_file = st.file_uploader("Choose a .txt file", type="txt")
|
7 |
|
8 |
# Add sliders to the sidebar
|
@@ -13,7 +20,7 @@ if uploaded_file is not None:
|
|
13 |
user_input = uploaded_file.read().decode('utf-8')
|
14 |
|
15 |
if st.button('Summarize'):
|
16 |
-
summarizer = pipeline('summarization')
|
17 |
summarized_text = ""
|
18 |
|
19 |
# Split the text into chunks of approximately 500 words each
|
|
|
3 |
import textwrap
|
4 |
|
5 |
st.title('Hugging Face BERT Summarizer')
|
6 |
+
|
7 |
+
# List of models
|
8 |
+
models = ["sshleifer/distilbart-cnn-12-6", "facebook/bart-large-cnn", "t5-base", "t5-large", "google/pegasus-newsroom"]
|
9 |
+
|
10 |
+
# Dropdown model selector
|
11 |
+
model = st.sidebar.selectbox("Choose a model", models)
|
12 |
+
|
13 |
uploaded_file = st.file_uploader("Choose a .txt file", type="txt")
|
14 |
|
15 |
# Add sliders to the sidebar
|
|
|
20 |
user_input = uploaded_file.read().decode('utf-8')
|
21 |
|
22 |
if st.button('Summarize'):
|
23 |
+
summarizer = pipeline('summarization', model=model)
|
24 |
summarized_text = ""
|
25 |
|
26 |
# Split the text into chunks of approximately 500 words each
|