Updated text output
Browse files
app.py
CHANGED
|
@@ -45,20 +45,20 @@ def process_pdf_file(pdf_file_path: str, ground_truth_invoices: str, ground_trut
|
|
| 45 |
verified_candidate, unverified_candidate = extracted_result
|
| 46 |
|
| 47 |
result = ""
|
| 48 |
-
result += f"Extracted invoice numbers and payment amounts:\n"
|
| 49 |
result += f"Ground Truth Invoices: {ground_truth_invoices}\n"
|
| 50 |
result += f"Ground Truth Amount: {ground_truth_amount}\n"
|
| 51 |
result += "-" * 40 + "\n"
|
| 52 |
|
| 53 |
# Print Invoice Numbers
|
| 54 |
-
result += "Invoice Numbers:\n"
|
| 55 |
for i, invoice_numbers in enumerate(unverified_candidate[0], 1):
|
| 56 |
status = "Verified" if any(set(invoice_numbers) == set(v) for v in verified_candidate[0]) else "Unverified"
|
| 57 |
result += f" Candidate {i} ({status}): {', '.join(invoice_numbers)}\n"
|
| 58 |
result += "\n"
|
| 59 |
|
| 60 |
# Print Payment Amounts
|
| 61 |
-
result += "Payment Amounts:\n"
|
| 62 |
for i, amount in enumerate(unverified_candidate[1], 1):
|
| 63 |
status = "Verified" if amount in verified_candidate[1] else "Unverified"
|
| 64 |
result += f" Candidate {i} ({status}): {amount}\n"
|
|
@@ -68,7 +68,7 @@ def process_pdf_file(pdf_file_path: str, ground_truth_invoices: str, ground_trut
|
|
| 68 |
error_message = f"An error occurred while processing the PDF: {str(e)}"
|
| 69 |
remittance_logger.error(error_message, exc_info=True)
|
| 70 |
return error_message
|
| 71 |
-
|
| 72 |
# Create the Gradio interface
|
| 73 |
with gr.Blocks() as iface:
|
| 74 |
gr.Markdown("# Remittance PDF Processor")
|
|
|
|
| 45 |
verified_candidate, unverified_candidate = extracted_result
|
| 46 |
|
| 47 |
result = ""
|
| 48 |
+
# result += f"Extracted invoice numbers and payment amounts:\n"
|
| 49 |
result += f"Ground Truth Invoices: {ground_truth_invoices}\n"
|
| 50 |
result += f"Ground Truth Amount: {ground_truth_amount}\n"
|
| 51 |
result += "-" * 40 + "\n"
|
| 52 |
|
| 53 |
# Print Invoice Numbers
|
| 54 |
+
result += "Extracted Invoice Numbers:\n"
|
| 55 |
for i, invoice_numbers in enumerate(unverified_candidate[0], 1):
|
| 56 |
status = "Verified" if any(set(invoice_numbers) == set(v) for v in verified_candidate[0]) else "Unverified"
|
| 57 |
result += f" Candidate {i} ({status}): {', '.join(invoice_numbers)}\n"
|
| 58 |
result += "\n"
|
| 59 |
|
| 60 |
# Print Payment Amounts
|
| 61 |
+
result += "Extracted Payment Amounts:\n"
|
| 62 |
for i, amount in enumerate(unverified_candidate[1], 1):
|
| 63 |
status = "Verified" if amount in verified_candidate[1] else "Unverified"
|
| 64 |
result += f" Candidate {i} ({status}): {amount}\n"
|
|
|
|
| 68 |
error_message = f"An error occurred while processing the PDF: {str(e)}"
|
| 69 |
remittance_logger.error(error_message, exc_info=True)
|
| 70 |
return error_message
|
| 71 |
+
|
| 72 |
# Create the Gradio interface
|
| 73 |
with gr.Blocks() as iface:
|
| 74 |
gr.Markdown("# Remittance PDF Processor")
|