Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -287,21 +287,8 @@ def run_ocr(uploaded_file):
|
|
| 287 |
if page_md:
|
| 288 |
parts.append(page_md)
|
| 289 |
|
| 290 |
-
#
|
| 291 |
-
#
|
| 292 |
-
# skip to avoid extracting body content that sits near the bottom of the page.
|
| 293 |
-
if footer_start_frac is not None and page_num < len(page_images):
|
| 294 |
-
img_path = page_images[page_num]
|
| 295 |
-
ftr = ""
|
| 296 |
-
if is_pdf:
|
| 297 |
-
ftr = extract_zone_text_pdf(path, page_num, fs, 1.0)
|
| 298 |
-
if not (ftr and ftr.strip()):
|
| 299 |
-
ftr = extract_pdf_text_in_band(path, page_num, PDF_FOOTER_BAND_FRAC, 1.0)
|
| 300 |
-
if not (ftr and ftr.strip()):
|
| 301 |
-
ftr = ocr_zone(img_path, fs, 1.0)
|
| 302 |
-
# Skip footer if its content already exists in page_md (avoids duplication)
|
| 303 |
-
if ftr and ftr.strip() and ftr.strip()[:80] not in page_md:
|
| 304 |
-
parts.append(ftr.strip())
|
| 305 |
|
| 306 |
if parts:
|
| 307 |
all_pages.append("\n\n".join(parts))
|
|
|
|
| 287 |
if page_md:
|
| 288 |
parts.append(page_md)
|
| 289 |
|
| 290 |
+
# Footer extraction removed — MaaS API already captures all footer
|
| 291 |
+
# content correctly inside page_md. Extracting again causes duplication.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 292 |
|
| 293 |
if parts:
|
| 294 |
all_pages.append("\n\n".join(parts))
|