credent007 commited on
Commit
b9a0250
·
verified ·
1 Parent(s): 34f3791

Update json_handling.py

Browse files
Files changed (1) hide show
  1. json_handling.py +8 -6
json_handling.py CHANGED
@@ -35,15 +35,17 @@ import json
35
  def process_whole_doc(file_path):
36
  images = load_input(file_path)
37
 
38
- complete_json = {}
 
39
 
40
  # PART_NAME = "PART-1 - BILL OF ENTRY SUMMARY" # you can change per doc type
41
  for i, image in enumerate(images, start=1):
42
  partial_json = process_document(image)
43
- print(partial_json)
44
- # 🔹 Extract only "result"
45
- result_data = partial_json.get("result", {})
46
- page_key = f"Page {i}"
 
47
  # Ensure structure exists
48
  # # if PART_NAME not in complete_json:
49
  # complete_json[] = [{}]
@@ -52,7 +54,7 @@ def process_whole_doc(file_path):
52
  # complete_json[PART_NAME].append({})
53
 
54
  # ✅ Merge directly
55
- complete_json[page_key]=result_data
56
 
57
  return complete_json
58
 
 
35
  def process_whole_doc(file_path):
36
  images = load_input(file_path)
37
 
38
+ complete_json = ""
39
+
40
 
41
  # PART_NAME = "PART-1 - BILL OF ENTRY SUMMARY" # you can change per doc type
42
  for i, image in enumerate(images, start=1):
43
  partial_json = process_document(image)
44
+ # print(partial_json)
45
+ complete_json = complete_json+partial_json
46
+ # # 🔹 Extract only "result"
47
+ # result_data = partial_json.get("result", {})
48
+ # page_key = f"Page {i}"
49
  # Ensure structure exists
50
  # # if PART_NAME not in complete_json:
51
  # complete_json[] = [{}]
 
54
  # complete_json[PART_NAME].append({})
55
 
56
  # ✅ Merge directly
57
+ # complete_json[page_key]=result_data
58
 
59
  return complete_json
60