Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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
|
|
|
|
| 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:
|