Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -283,8 +283,10 @@ def run_ocr(uploaded_file):
|
|
| 283 |
if page_md:
|
| 284 |
parts.append(page_md)
|
| 285 |
|
| 286 |
-
#
|
| 287 |
-
|
|
|
|
|
|
|
| 288 |
img_path = page_images[page_num]
|
| 289 |
ftr = ""
|
| 290 |
if is_pdf:
|
|
@@ -314,4 +316,4 @@ with gr.Blocks(title="GLM-OCR") as demo:
|
|
| 314 |
run_btn.click(fn=run_ocr, inputs=file_in, outputs=out)
|
| 315 |
|
| 316 |
if __name__ == "__main__":
|
| 317 |
-
demo.launch()
|
|
|
|
| 283 |
if page_md:
|
| 284 |
parts.append(page_md)
|
| 285 |
|
| 286 |
+
# Only run footer band if API actually detected a footer region via bbox.
|
| 287 |
+
# When footer_start_frac is None it means MaaS found no footer region —
|
| 288 |
+
# skip to avoid extracting body content that sits near the bottom of the page.
|
| 289 |
+
if footer_start_frac is not None and page_num < len(page_images):
|
| 290 |
img_path = page_images[page_num]
|
| 291 |
ftr = ""
|
| 292 |
if is_pdf:
|
|
|
|
| 316 |
run_btn.click(fn=run_ocr, inputs=file_in, outputs=out)
|
| 317 |
|
| 318 |
if __name__ == "__main__":
|
| 319 |
+
demo.launch()
|