Spaces:
Running
Running
Commit History
-
ocr_frame: filter noise per-word by Tesseract confidence, not per-documentβ
ClaudeThe doc-level "any 3+ char run = keep everything" heuristic let entire paragraphs of noise through whenever Tesseract hallucinated a single high-confidence word. Real-world example: a close-up of a heat-pump AC unit's fan grille produced "Soweer" (a confident-looking hallucination) plus a dozen lines of "ee", "es Re Re", "SS ESS ES SS" gibberish β and because "Soweer" had a 6-char alnum run, all the surrounding noise sailed through the filter unchanged. Switch from image_to_string to image_to_data to get per-word confidence scores, and drop any word below _MIN_WORD_CONFIDENCE (60) before reassembling lines. Tesseract's own quality estimate is a far better signal than counting alphanumeric runs after the fact. The doc-level _has_real_text check stays as a final sanity net for the case where the confidence filter leaves nothing usable. Tests updated to mock image_to_data with synthetic (word, conf, line) tuples; the heat-pump-style hallucination test pins the specific regression.6f1015b -
ocr_frame: return "" for textless frames so the guide hides the panelβ
ClaudeTesseract on a frame with no real on-screen text (photo, diagram, talking-head shot, blank transition) routinely emits a few stray punctuation marks or single letters. With our existing "{% if seg.ocr_text %}" gate that's still truthy, so the rendered guide showed an empty-looking "On-screen text from video" panel full of noise. After merging the normal + inverted passes, check the output for an alphanumeric run of 3+ characters somewhere. If none exists, treat the frame as textless and return "". Captures real short labels ("Lab", "Slide 3", year-only slides) while filtering out "/| _", "a b c", and similar Tesseract artefacts. The guide template's existing empty-check then hides the panel automatically.7873ecc
-
Add skip_inverted_ocr flag to opt out of the inverted Tesseract passβ
ClaudeThe inverted-binarization pass exists to recover white-on-coloured callout text the normal pass turns into noise, but on slides with no such callouts it just halves throughput and risks producing garbled near-duplicates of body text (filtered as of the previous fix). Add a per-job toggle that disables the inverted pass entirely: - ocr_frame(skip_inverted=True) returns only normal-pass output - PipelineInputs.skip_inverted_ocr threads it through the orchestrator - /jobs and /process endpoints accept skip_inverted_ocr as a form field - CLI exposes --skip-inverted-ocr on build and metadata - Upload page advanced settings include a "Skip inverted OCR pass" toggle - Job remembers the choice so the lazy /ocr endpoint stays consistent when the reviewer picks an alt frame in the editor355b428 -
Drop garbled inverted-pass OCR lines that near-duplicate clean onesβ
Claudeocr_frame runs Tesseract on two binarizations β a normal pass for the dark-on-light body, and an inverted pass for white-on-coloured callout text. The inverted pass on a normal slide usually produces noisy near-duplicates of the body lines (e.g. "How do we increase heat pump installation rates?" becomes "ow co we iharease lice? Gunip installation cakes?"). The exact-match dedupe couldn't catch those, so both versions ended up stacked in the guide's on-screen-text panel. Filter inverted-pass lines through a difflib fuzzy compare against the normal-pass output and drop matches above 0.6. Genuine callout text β the whole reason for the inverted pass β is dissimilar to body lines and stays. Normalization strips punctuation/case so OCR drift on those doesn't defeat the comparison.11a6e81