rehan953 commited on
Commit
e707a60
·
verified ·
1 Parent(s): 2a58fa8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -281,7 +281,8 @@ def run_ocr(uploaded_file):
281
  hdr = extract_pdf_text_in_band(path, page_num, 0, PDF_HEADER_BAND_FRAC)
282
  if not (hdr and hdr.strip()):
283
  hdr = ocr_zone(img_path, 0, he)
284
- if hdr and hdr.strip():
 
285
  parts.append(hdr.strip())
286
 
287
  if page_md:
 
281
  hdr = extract_pdf_text_in_band(path, page_num, 0, PDF_HEADER_BAND_FRAC)
282
  if not (hdr and hdr.strip()):
283
  hdr = ocr_zone(img_path, 0, he)
284
+ # Skip header if already present in page_md (avoids duplicating body content)
285
+ if hdr and hdr.strip() and hdr.strip()[:80] not in page_md:
286
  parts.append(hdr.strip())
287
 
288
  if page_md: