Spaces:
Running
Running
add fancy error
Browse filesSigned-off-by: peter szemraj <[email protected]>
app.py
CHANGED
|
@@ -79,7 +79,13 @@ def convert_PDF(
|
|
| 79 |
file_path = Path(pdf_obj.name)
|
| 80 |
if not file_path.suffix == ".pdf":
|
| 81 |
logging.error(f"File {file_path} is not a PDF file")
|
| 82 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
conversion_stats = convert_PDF_to_Text(
|
| 84 |
file_path,
|
| 85 |
ocr_model=ocr_model,
|
|
|
|
| 79 |
file_path = Path(pdf_obj.name)
|
| 80 |
if not file_path.suffix == ".pdf":
|
| 81 |
logging.error(f"File {file_path} is not a PDF file")
|
| 82 |
+
|
| 83 |
+
html_error = f"""
|
| 84 |
+
<div style="color: red; font-size: 20px; font-weight: bold;">
|
| 85 |
+
File {file_path} is not a PDF file
|
| 86 |
+
</div>
|
| 87 |
+
"""
|
| 88 |
+
return "File is not a PDF file", html_error, None
|
| 89 |
conversion_stats = convert_PDF_to_Text(
|
| 90 |
file_path,
|
| 91 |
ocr_model=ocr_model,
|