Spaces:
Sleeping
Sleeping
Amamrnaf
commited on
Commit
·
985808a
1
Parent(s):
c38db77
`Removed file_path parameter from Noc_timeSheet_pdf_to_img function and updated calls in process_file function.`
Browse files
app.py
CHANGED
|
@@ -6,9 +6,9 @@ from functions import get_image_informations
|
|
| 6 |
from dataSchema import *
|
| 7 |
# import shutil
|
| 8 |
|
| 9 |
-
def Noc_timeSheet_pdf_to_img(pdf_path,
|
| 10 |
pdf_document = pymupdf.open(pdf_path)
|
| 11 |
-
|
| 12 |
# Get the first page of the PDF
|
| 13 |
page = pdf_document.load_page(0) # 0 is the first page
|
| 14 |
|
|
@@ -126,11 +126,11 @@ def process_file(file, option):
|
|
| 126 |
if file_extension in ['.pdf']:
|
| 127 |
# Process PDF files
|
| 128 |
if option == "Noc_timesheet_residential":
|
| 129 |
-
Noc_timeSheet_pdf_to_img(file_path
|
| 130 |
result = get_image_informations("output.jpg", Noc_Res_timesheet_prompt, Noc_Res_timeSheet_parser)
|
| 131 |
return result
|
| 132 |
elif option == "Noc_timesheet_rotational":
|
| 133 |
-
Noc_timeSheet_pdf_to_img(file_path
|
| 134 |
result = get_image_informations("output.jpg", Noc_Rot_timesheet_prompt, Noc_Rot_timeSheet_parser)
|
| 135 |
return result
|
| 136 |
elif option == "Noc_invoice":
|
|
|
|
| 6 |
from dataSchema import *
|
| 7 |
# import shutil
|
| 8 |
|
| 9 |
+
def Noc_timeSheet_pdf_to_img(pdf_path,dpi: int = 300, quality: int = 95):
|
| 10 |
pdf_document = pymupdf.open(pdf_path)
|
| 11 |
+
output_path="output.jpg"
|
| 12 |
# Get the first page of the PDF
|
| 13 |
page = pdf_document.load_page(0) # 0 is the first page
|
| 14 |
|
|
|
|
| 126 |
if file_extension in ['.pdf']:
|
| 127 |
# Process PDF files
|
| 128 |
if option == "Noc_timesheet_residential":
|
| 129 |
+
Noc_timeSheet_pdf_to_img(file_path)
|
| 130 |
result = get_image_informations("output.jpg", Noc_Res_timesheet_prompt, Noc_Res_timeSheet_parser)
|
| 131 |
return result
|
| 132 |
elif option == "Noc_timesheet_rotational":
|
| 133 |
+
Noc_timeSheet_pdf_to_img(file_path)
|
| 134 |
result = get_image_informations("output.jpg", Noc_Rot_timesheet_prompt, Noc_Rot_timeSheet_parser)
|
| 135 |
return result
|
| 136 |
elif option == "Noc_invoice":
|