Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -51,6 +51,7 @@ if uploaded_file:
|
|
| 51 |
num_splits = st.number_input("How many splits do you want?", min_value=1, max_value=total_pages, step=1, value=1)
|
| 52 |
|
| 53 |
output_files_with_ranges = []
|
|
|
|
| 54 |
for i in range(num_splits):
|
| 55 |
st.write(f"### Split {i + 1}")
|
| 56 |
start = st.number_input(f"Start page for split {i + 1}", min_value=1, max_value=total_pages, step=1, value=1, key=f"start_{i}")
|
|
@@ -64,3 +65,10 @@ if uploaded_file:
|
|
| 64 |
|
| 65 |
if st.button("Split PDF"):
|
| 66 |
split_pdf(input_pdf_path, output_files_with_ranges)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
num_splits = st.number_input("How many splits do you want?", min_value=1, max_value=total_pages, step=1, value=1)
|
| 52 |
|
| 53 |
output_files_with_ranges = []
|
| 54 |
+
download_links = []
|
| 55 |
for i in range(num_splits):
|
| 56 |
st.write(f"### Split {i + 1}")
|
| 57 |
start = st.number_input(f"Start page for split {i + 1}", min_value=1, max_value=total_pages, step=1, value=1, key=f"start_{i}")
|
|
|
|
| 65 |
|
| 66 |
if st.button("Split PDF"):
|
| 67 |
split_pdf(input_pdf_path, output_files_with_ranges)
|
| 68 |
+
|
| 69 |
+
for output_file, _ in output_files_with_ranges:
|
| 70 |
+
with open(output_file, "rb") as f:
|
| 71 |
+
download_links.append((output_file, f.read()))
|
| 72 |
+
|
| 73 |
+
for filename, data in download_links:
|
| 74 |
+
st.download_button(label=f"Download {filename}", data=data, file_name=filename, mime="application/pdf")
|