Update app.py
Browse files
app.py
CHANGED
|
@@ -114,14 +114,14 @@ def process_image(image):
|
|
| 114 |
|
| 115 |
# Convert OCR results to JSON
|
| 116 |
json_results = convert_to_json(ocr_results[0])
|
| 117 |
-
json_results_path =
|
| 118 |
with open(json_results_path, "w") as f:
|
| 119 |
json.dump(json_results, f, indent=4)
|
| 120 |
|
| 121 |
# Extract field-value pairs from the text
|
| 122 |
text = " ".join([result[1][0] for result in ocr_results[0]])
|
| 123 |
field_value_pairs = extract_field_value_pairs(text)
|
| 124 |
-
field_value_pairs_path =
|
| 125 |
with open(field_value_pairs_path, "w") as f:
|
| 126 |
json.dump(field_value_pairs, f, indent=4)
|
| 127 |
|
|
|
|
| 114 |
|
| 115 |
# Convert OCR results to JSON
|
| 116 |
json_results = convert_to_json(ocr_results[0])
|
| 117 |
+
json_results_path = 'ocr_results.json' # Save in the root directory
|
| 118 |
with open(json_results_path, "w") as f:
|
| 119 |
json.dump(json_results, f, indent=4)
|
| 120 |
|
| 121 |
# Extract field-value pairs from the text
|
| 122 |
text = " ".join([result[1][0] for result in ocr_results[0]])
|
| 123 |
field_value_pairs = extract_field_value_pairs(text)
|
| 124 |
+
field_value_pairs_path = 'extracted_fields.json' # Save in the root directory
|
| 125 |
with open(field_value_pairs_path, "w") as f:
|
| 126 |
json.dump(field_value_pairs, f, indent=4)
|
| 127 |
|