Spaces:
Running
Running
Aymeric Ducatez
commited on
Commit
·
fdf393b
1
Parent(s):
2c5fdb6
debug6
Browse files
app.py
CHANGED
|
@@ -23,11 +23,12 @@ def extract_pages(pdf_path, start_page, end_page, output_path):
|
|
| 23 |
writer.write(output_pdf_file)
|
| 24 |
|
| 25 |
|
| 26 |
-
def reduce_pdf(
|
| 27 |
if not os.path.exists(reduced_pdf_folder):
|
| 28 |
os.makedirs(reduced_pdf_folder)
|
| 29 |
-
|
| 30 |
-
for filename in
|
|
|
|
| 31 |
if filename.endswith('.pdf'):
|
| 32 |
match = re.search(r'(\d+)-(\d+)', filename)
|
| 33 |
if match:
|
|
@@ -203,7 +204,6 @@ def reduce_and_convert(input_folder):
|
|
| 203 |
|
| 204 |
|
| 205 |
def ui(input_files):
|
| 206 |
-
print("TESTTESTTEST")
|
| 207 |
output_zip = "./output.zip"
|
| 208 |
if os.path.exists(output_zip):
|
| 209 |
os.remove(output_zip)
|
|
@@ -215,6 +215,7 @@ def ui(input_files):
|
|
| 215 |
|
| 216 |
# Move files into the extract_folder
|
| 217 |
for file_path in input_files:
|
|
|
|
| 218 |
shutil.copy(file_path, extract_folder)
|
| 219 |
|
| 220 |
reduce_and_convert(extract_folder)
|
|
|
|
| 23 |
writer.write(output_pdf_file)
|
| 24 |
|
| 25 |
|
| 26 |
+
def reduce_pdf(input_folder,reduced_pdf_folder):
|
| 27 |
if not os.path.exists(reduced_pdf_folder):
|
| 28 |
os.makedirs(reduced_pdf_folder)
|
| 29 |
+
print(os.listdir(input_folder))
|
| 30 |
+
for filename in os.listdir(input_folder):
|
| 31 |
+
print(filename)
|
| 32 |
if filename.endswith('.pdf'):
|
| 33 |
match = re.search(r'(\d+)-(\d+)', filename)
|
| 34 |
if match:
|
|
|
|
| 204 |
|
| 205 |
|
| 206 |
def ui(input_files):
|
|
|
|
| 207 |
output_zip = "./output.zip"
|
| 208 |
if os.path.exists(output_zip):
|
| 209 |
os.remove(output_zip)
|
|
|
|
| 215 |
|
| 216 |
# Move files into the extract_folder
|
| 217 |
for file_path in input_files:
|
| 218 |
+
print(file_path)
|
| 219 |
shutil.copy(file_path, extract_folder)
|
| 220 |
|
| 221 |
reduce_and_convert(extract_folder)
|