zombee11 commited on
Commit
56e2dbe
·
verified ·
1 Parent(s): 94f18fa

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +3 -3
main.py CHANGED
@@ -101,7 +101,7 @@ async def process_document(file: UploadFile = File(...)):
101
  # VID: 16 digits or text context
102
  if "VID" in text_upper and len(clean) >= 12:
103
  extracted["vid"] = clean
104
- img = apply_mask(img, bbox, 0.78) # Mask first 12 digits
105
 
106
  # Scenario B: "VID" is in one box, numbers are in the NEXT box
107
  elif "VID" in text_upper:
@@ -110,12 +110,12 @@ async def process_document(file: UploadFile = File(...)):
110
  next_clean = get_clean_digits(next_text)
111
  if len(next_clean) >= 12:
112
  extracted["vid"] = next_clean
113
- img = apply_mask(img, next_bbox, 0.78)
114
 
115
  # Scenario C: 16 digits found standalone
116
  elif len(clean) == 16:
117
  extracted["vid"] = clean
118
- img = apply_mask(img, bbox, 0.78)
119
 
120
  _, buffer = cv2.imencode('.jpg', img)
121
  return Response(
 
101
  # VID: 16 digits or text context
102
  if "VID" in text_upper and len(clean) >= 12:
103
  extracted["vid"] = clean
104
+ img = apply_mask(img, bbox, 0.79) # Mask first 12 digits
105
 
106
  # Scenario B: "VID" is in one box, numbers are in the NEXT box
107
  elif "VID" in text_upper:
 
110
  next_clean = get_clean_digits(next_text)
111
  if len(next_clean) >= 12:
112
  extracted["vid"] = next_clean
113
+ img = apply_mask(img, next_bbox, 0.79)
114
 
115
  # Scenario C: 16 digits found standalone
116
  elif len(clean) == 16:
117
  extracted["vid"] = clean
118
+ img = apply_mask(img, bbox, 0.79)
119
 
120
  _, buffer = cv2.imencode('.jpg', img)
121
  return Response(