rehan953 commited on
Commit
7291c66
·
verified ·
1 Parent(s): 6dd297d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -283,8 +283,9 @@ def run_ocr(uploaded_file):
283
  if page_md:
284
  parts.append(page_md)
285
 
286
- # Always run footer band (bottom 8–12% of page)
287
- if page_num < len(page_images):
 
288
  img_path = page_images[page_num]
289
  ftr = ""
290
  if is_pdf:
@@ -314,4 +315,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
+ # (footer_start_frac is None when MaaS finds no footer — avoids grabbing body content)
288
+ if footer_start_frac is not None and page_num < len(page_images):
289
  img_path = page_images[page_num]
290
  ftr = ""
291
  if is_pdf:
 
315
  run_btn.click(fn=run_ocr, inputs=file_in, outputs=out)
316
 
317
  if __name__ == "__main__":
318
+ demo.launch()