Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,6 +98,10 @@ def extract_numeric_values(pdf_file, schedule1_file=None, client_name="Unknown C
|
|
| 98 |
all_extracted_values = page1_values + page2_values
|
| 99 |
schedule1_values = []
|
| 100 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
if schedule1_file:
|
| 102 |
if isinstance(schedule1_file, str):
|
| 103 |
doc = fitz.open(schedule1_file)
|
|
@@ -137,9 +141,9 @@ def extract_numeric_values(pdf_file, schedule1_file=None, client_name="Unknown C
|
|
| 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 |
|
|
|
|
| 143 |
except Exception as e:
|
| 144 |
return f"Error occurred:\n{str(e)}", None, None
|
| 145 |
|
|
|
|
| 98 |
all_extracted_values = page1_values + page2_values
|
| 99 |
schedule1_values = []
|
| 100 |
|
| 101 |
+
output_folder = "./temp_outputs"
|
| 102 |
+
os.makedirs(output_folder, exist_ok=True)
|
| 103 |
+
schedule1_pdf_path = None # initialize
|
| 104 |
+
|
| 105 |
if schedule1_file:
|
| 106 |
if isinstance(schedule1_file, str):
|
| 107 |
doc = fitz.open(schedule1_file)
|
|
|
|
| 141 |
output_dir = "./Clients_Output_Data_Form_1040.csv"
|
| 142 |
save_to_csv_flat(all_extracted_values, schedule1_values, client_name=client_name, csv_path=output_dir)
|
| 143 |
|
|
|
|
| 144 |
return "\n".join(output), output_dir, output_pdf_path, schedule1_pdf_path
|
| 145 |
|
| 146 |
+
|
| 147 |
except Exception as e:
|
| 148 |
return f"Error occurred:\n{str(e)}", None, None
|
| 149 |
|