Commit
·
4d3ca74
1
Parent(s):
4b1ed8b
Update app.py
Browse files
app.py
CHANGED
|
@@ -19,6 +19,9 @@ keywords = st.text_input("Enter keywords (comma-separated)")
|
|
| 19 |
# Add slider to the sidebar for the scale value
|
| 20 |
scale_percentage = st.sidebar.slider('Scale %', min_value=1, max_value=100, value=50)
|
| 21 |
|
|
|
|
|
|
|
|
|
|
| 22 |
if uploaded_file is not None and keywords:
|
| 23 |
user_input = uploaded_file.read().decode('utf-8')
|
| 24 |
keywords = [keyword.strip() for keyword in keywords.split(",")]
|
|
@@ -32,8 +35,8 @@ if uploaded_file is not None and keywords:
|
|
| 32 |
summarizer = pipeline('summarization', model=model)
|
| 33 |
summarized_text = ""
|
| 34 |
|
| 35 |
-
# Split the filtered text into chunks of approximately
|
| 36 |
-
chunks = textwrap.wrap(filtered_text,
|
| 37 |
|
| 38 |
# Summarize each chunk
|
| 39 |
for chunk in chunks:
|
|
|
|
| 19 |
# Add slider to the sidebar for the scale value
|
| 20 |
scale_percentage = st.sidebar.slider('Scale %', min_value=1, max_value=100, value=50)
|
| 21 |
|
| 22 |
+
# Add slider for the chunk size
|
| 23 |
+
chunk_size = st.sidebar.slider('Chunk size', min_value=100, max_value=1000, value=500)
|
| 24 |
+
|
| 25 |
if uploaded_file is not None and keywords:
|
| 26 |
user_input = uploaded_file.read().decode('utf-8')
|
| 27 |
keywords = [keyword.strip() for keyword in keywords.split(",")]
|
|
|
|
| 35 |
summarizer = pipeline('summarization', model=model)
|
| 36 |
summarized_text = ""
|
| 37 |
|
| 38 |
+
# Split the filtered text into chunks of approximately the selected chunk size each
|
| 39 |
+
chunks = textwrap.wrap(filtered_text, chunk_size)
|
| 40 |
|
| 41 |
# Summarize each chunk
|
| 42 |
for chunk in chunks:
|