Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -126,8 +126,17 @@ def extract_numeric_values(pdf_file, schedule1_file=None, client_name="Unknown C
|
|
| 126 |
output += [f"Schedule 1 Line {i*2+1 if i < 2 else 8}: {val}" for i, val in enumerate(schedule1_values)]
|
| 127 |
doc.close()
|
| 128 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 129 |
output_dir = "./Clients_Output_Data_Form_1040.csv"
|
| 130 |
save_to_csv_flat(all_extracted_values, schedule1_values, client_name=client_name, csv_path=output_dir)
|
|
|
|
| 131 |
|
| 132 |
return "\n".join(output), output_dir, output_pdf_path, schedule1_pdf_path
|
| 133 |
|
|
|
|
| 126 |
output += [f"Schedule 1 Line {i*2+1 if i < 2 else 8}: {val}" for i, val in enumerate(schedule1_values)]
|
| 127 |
doc.close()
|
| 128 |
|
| 129 |
+
else:
|
| 130 |
+
# Create a temporary empty file as a placeholder
|
| 131 |
+
empty_path = os.path.join(output_folder, "empty_schedule1.pdf")
|
| 132 |
+
if not os.path.exists(empty_path):
|
| 133 |
+
with open(empty_path, "wb") as f:
|
| 134 |
+
f.write(b"%PDF-1.4\n%%EOF")
|
| 135 |
+
schedule1_pdf_output = empty_path
|
| 136 |
+
|
| 137 |
output_dir = "./Clients_Output_Data_Form_1040.csv"
|
| 138 |
save_to_csv_flat(all_extracted_values, schedule1_values, client_name=client_name, csv_path=output_dir)
|
| 139 |
+
|
| 140 |
|
| 141 |
return "\n".join(output), output_dir, output_pdf_path, schedule1_pdf_path
|
| 142 |
|