fix: remove unused import, add duplicate redaction detection

- Remove unused detect_redactions import from app.py
- Add de-duplication check in dblclick handler to prevent
  creating duplicate redaction entries for the same dark region

Co-Authored-By: Claude Opus 4.6 <[email protected]>
This commit is contained in:
Alex-GilbertandClaude Opus 4.6 committed 2026-02-16 18:02:54 -06:00
1 parent 6ca949b233
commit 35b898af50
2 files changed
+13 -1

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ from PIL import Image, ImageFont
from sse_starlette.sse import EventSourceResponse
from unredact.pipeline.rasterize import rasterize_pdf
from unredact.pipeline.detect_redactions import detect_redactions, spot_redaction
from unredact.pipeline.detect_redactions import spot_redaction
from unredact.pipeline.ocr import ocr_page
from unredact.pipeline.font_detect import detect_font_for_line, CANDIDATE_FONTS, _find_font_path
from unredact.pipeline.solver import build_constraint, SolveResult
+12
View File
@@ -915,6 +915,18 @@ rightPanel.addEventListener("dblclick", async (e) => {
const data = await resp.json();
const box = data.box;
// De-duplicate: if a redaction with the same box already exists, just activate it
const existingDup = Object.values(state.redactions).find(r =>
r.page === state.currentPage &&
Math.abs(r.x - box.x) < 3 && Math.abs(r.y - box.y) < 3 &&
Math.abs(r.w - box.w) < 3 && Math.abs(r.h - box.h) < 3
);
if (existingDup) {
activateRedaction(existingDup.id);
return;
}
const id = "m" + Date.now().toString(36);
state.redactions[id] = {