Commit
·
17ad421
1
Parent(s):
eb51c13
Update app.py
Browse files
app.py
CHANGED
@@ -5,6 +5,10 @@ import textwrap
|
|
5 |
st.title('Hugging Face BERT Summarizer')
|
6 |
uploaded_file = st.file_uploader("Choose a .txt file", type="txt")
|
7 |
|
|
|
|
|
|
|
|
|
8 |
if uploaded_file is not None:
|
9 |
user_input = uploaded_file.read().decode('utf-8')
|
10 |
|
@@ -17,7 +21,7 @@ if uploaded_file is not None:
|
|
17 |
|
18 |
# Summarize each chunk
|
19 |
for chunk in chunks:
|
20 |
-
summarized = summarizer(chunk, max_length=
|
21 |
summarized_text += summarized[0]['summary_text'] + " "
|
22 |
|
23 |
st.text_area('Summarized Text', summarized_text, height=200)
|
|
|
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
|
9 |
+
min_length = st.sidebar.slider('Minimum Length', min_value=10, max_value=100, value=30)
|
10 |
+
max_length = st.sidebar.slider('Maximum Length', min_value=100, max_value=500, value=130)
|
11 |
+
|
12 |
if uploaded_file is not None:
|
13 |
user_input = uploaded_file.read().decode('utf-8')
|
14 |
|
|
|
21 |
|
22 |
# Summarize each chunk
|
23 |
for chunk in chunks:
|
24 |
+
summarized = summarizer(chunk, max_length=max_length, min_length=min_length, do_sample=False)
|
25 |
summarized_text += summarized[0]['summary_text'] + " "
|
26 |
|
27 |
st.text_area('Summarized Text', summarized_text, height=200)
|