attempt streamline
Browse filesSigned-off-by: peter szemraj <peterszemraj@gmail.com>
app.py
CHANGED
@@ -31,7 +31,6 @@ def load_uploaded_file(file_obj, temp_dir: Path = None):
|
|
31 |
str, the uploaded file contents
|
32 |
"""
|
33 |
|
34 |
-
# check if mysterious file object is a list
|
35 |
# check if mysterious file object is a list
|
36 |
if isinstance(file_obj, list):
|
37 |
file_obj = file_obj[0]
|
@@ -70,9 +69,12 @@ def convert_PDF(pdf_obj, language: str = "en"):
|
|
70 |
|
71 |
global ocr_model
|
72 |
st = time.perf_counter()
|
|
|
|
|
|
|
73 |
|
74 |
conversion_stats = convert_PDF_to_Text(
|
75 |
-
|
76 |
ocr_model=ocr_model,
|
77 |
max_pages=20,
|
78 |
)
|
|
|
31 |
str, the uploaded file contents
|
32 |
"""
|
33 |
|
|
|
34 |
# check if mysterious file object is a list
|
35 |
if isinstance(file_obj, list):
|
36 |
file_obj = file_obj[0]
|
|
|
69 |
|
70 |
global ocr_model
|
71 |
st = time.perf_counter()
|
72 |
+
if isinstance(pdf_obj, list):
|
73 |
+
pdf_obj = pdf_obj[0]
|
74 |
+
file_path = Path(pdf_obj.name)
|
75 |
|
76 |
conversion_stats = convert_PDF_to_Text(
|
77 |
+
file_path,
|
78 |
ocr_model=ocr_model,
|
79 |
max_pages=20,
|
80 |
)
|