Spaces:
Sleeping
Sleeping
Geetansh
commited on
Commit
·
78e4afe
1
Parent(s):
8553eb4
Added constraint to process 4 pages at max
Browse files- pdf_to_image.py +4 -4
pdf_to_image.py
CHANGED
@@ -12,14 +12,14 @@ from pdf2image.exceptions import (
|
|
12 |
# 1)Images stored in output folder
|
13 |
# 2)It returns path to stored images
|
14 |
# '''
|
15 |
-
# images_paths = convert_from_path(pdfPath, 200, outputPath, fmt="jpeg", poppler_path=poppler_path, paths_only=True)
|
16 |
# return images_paths
|
17 |
|
18 |
# def pdfToImg2(pdfPath):
|
19 |
# '''
|
20 |
# 1)Returns a list of Pillow images
|
21 |
# '''
|
22 |
-
# images = convert_from_path(pdfPath, 200, fmt="jpeg", poppler_path=poppler_path)
|
23 |
# return images
|
24 |
|
25 |
# Changed version of above code for deployment on huggingface spaces
|
@@ -28,12 +28,12 @@ def pdfToImg(pdfPath, outputPath):
|
|
28 |
1)Images stored in output folder
|
29 |
2)It returns path to stored images
|
30 |
'''
|
31 |
-
images_paths = convert_from_path(pdfPath, 200, outputPath, fmt="jpeg", paths_only=True)
|
32 |
return images_paths
|
33 |
|
34 |
def pdfToImg2(pdfPath):
|
35 |
'''
|
36 |
1)Returns a list of Pillow images
|
37 |
'''
|
38 |
-
images = convert_from_path(pdfPath, 200, fmt="jpeg")
|
39 |
return images
|
|
|
12 |
# 1)Images stored in output folder
|
13 |
# 2)It returns path to stored images
|
14 |
# '''
|
15 |
+
# images_paths = convert_from_path(pdfPath, 200, outputPath, fmt="jpeg", poppler_path=poppler_path, paths_only=True, last_page=4) # Only processing 4 pages at max
|
16 |
# return images_paths
|
17 |
|
18 |
# def pdfToImg2(pdfPath):
|
19 |
# '''
|
20 |
# 1)Returns a list of Pillow images
|
21 |
# '''
|
22 |
+
# images = convert_from_path(pdfPath, 200, fmt="jpeg", poppler_path=poppler_path, last_page=4) # Only processing 4 pages at max
|
23 |
# return images
|
24 |
|
25 |
# Changed version of above code for deployment on huggingface spaces
|
|
|
28 |
1)Images stored in output folder
|
29 |
2)It returns path to stored images
|
30 |
'''
|
31 |
+
images_paths = convert_from_path(pdfPath, 200, outputPath, fmt="jpeg", paths_only=True, last_page=4) # Only processing 4 pages at max
|
32 |
return images_paths
|
33 |
|
34 |
def pdfToImg2(pdfPath):
|
35 |
'''
|
36 |
1)Returns a list of Pillow images
|
37 |
'''
|
38 |
+
images = convert_from_path(pdfPath, 200, fmt="jpeg", last_page=4) # Only processing 4 pages at max
|
39 |
return images
|