Spaces:
Running
Running
Strict background artwork line pruning to eliminate spurious bboxes
Browse filesFiles changed (2)
- Dockerfile+2-2
- ocr_webapp/app.py+5-5
1234513 unmodified lines19202122232425FROM python:3.11-slim# Rebuild timestamp: 2026-07-31T11:01:50Z - Debug raw meta inside do_POSTENV DEBIAN_FRONTEND=noninteractive13 unmodified linesRUN pip install --no-cache-dir -r requirements.txt# Force cache bust for updated app codeRUN echo "Cache bust 2026-07-31T11:01:50Z"# Copy application filesCOPY . /app1234513 unmodified lines19202122232425FROM python:3.11-slim# Rebuild timestamp: 2026-07-31T11:30:10Z - Strict background artwork pruningENV DEBIAN_FRONTEND=noninteractive13 unmodified linesRUN pip install --no-cache-dir -r requirements.txt# Force cache bust for updated app codeRUN echo "Cache bust 2026-07-31T11:30:10Z"# Copy application filesCOPY . /app
983 unmodified lines984985986987988989990991992993208 unmodified lines1202120312041205120612071208983 unmodified lineshas_cham_char = any('\uA800' <= char <= '\uA82F' or '\uA840' <= char <= '\uA87F' for char in pred)has_alphanumeric = any(char.isalnum() for char in pred)# Filter out false positive lines from background artwork (confidence < 0.20 and no meaningful text/Cham chars)is_fake_background = (conf < 0.20 and not has_cham_char and not (has_alphanumeric and len(pred) >= 2))if not is_fake_background:filtered_lines_meta.append(meta)filtered_final_crops.append(crop)208 unmodified lines# Backward-compatible formatprint(f"📥 [DO_POST RAW META] line_id={meta.get('line_id')}, bbox={meta.get('bbox')}, keys={list(meta.keys())}")results.append({'index': meta['line_id'] + 1,'text': pred_text,'confidence': float(confidence),'coords': meta['core_box'],983 unmodified lines984985986987988989990991992993208 unmodified lines1202120312041205120612071208983 unmodified lineshas_cham_char = any('\uA800' <= char <= '\uA82F' or '\uA840' <= char <= '\uA87F' for char in pred)has_alphanumeric = any(char.isalnum() for char in pred)# Strict filter out false positive lines from background artwork (dragons, elephants, ocean graphics)# Any line with confidence < 0.50 that does NOT contain valid Cham characters is treated as fake background artworkis_fake_background = (conf < 0.50 and not has_cham_char)if not is_fake_background and conf >= 0.15:filtered_lines_meta.append(meta)filtered_final_crops.append(crop)208 unmodified lines# Backward-compatible formatprint(f"📥 [DO_POST RAW META] line_id={meta.get('line_id')}, bbox={meta.get('bbox')}, keys={list(meta.keys())}")results.append({'index': idx + 1,'text': pred_text,'confidence': float(confidence),'coords': meta['core_box'],
Dockerfile+2-2
ocr_webapp/app.py+5-5