Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,8 +15,10 @@ Universal image pipeline (same for every PDF, no keywords / no bank logic):
|
|
| 15 |
thin rules and small glyphs are easier to read before recognition.
|
| 16 |
|
| 17 |
Explicitly omitted vs the heavy Space build:
|
| 18 |
-
- No
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
|
| 21 |
Configure GLMOCR_API_KEY (environment variable). Optional: glmocr + gradio +
|
| 22 |
pymupdf + pillow installed.
|
|
@@ -70,24 +72,24 @@ if not GLMOCR_API_KEY:
|
|
| 70 |
|
| 71 |
# Rasterization: higher scale = more pixels per PDF point (helps small type,
|
| 72 |
# boxed headers, and narrow columns). Same constant for all uploads.
|
| 73 |
-
RENDER_SCALE =
|
| 74 |
|
| 75 |
# White margin as a fraction of page width/height after render. Extra right
|
| 76 |
# margin helps right-aligned currency columns that hug the page edge.
|
| 77 |
-
PAD_LEFT_FRAC = 0.
|
| 78 |
-
PAD_RIGHT_FRAC = 0.
|
| 79 |
-
PAD_TOP_FRAC = 0.
|
| 80 |
-
PAD_BOTTOM_FRAC = 0.
|
| 81 |
|
| 82 |
ENABLE_CONTRAST = True
|
| 83 |
# Slight contrast lift only; same factor for every file.
|
| 84 |
-
CONTRAST_FACTOR = 1.
|
| 85 |
|
| 86 |
# Subtle edge enhancement after contrast (helps hairlines and small digits).
|
| 87 |
ENABLE_UNSHARP = True
|
| 88 |
-
UNSHARP_RADIUS = 0.
|
| 89 |
-
UNSHARP_PERCENT =
|
| 90 |
-
UNSHARP_THRESHOLD =
|
| 91 |
|
| 92 |
DEFAULT_ZONE_FRAC = 0.12
|
| 93 |
PDF_HEADER_BAND_FRAC = 0.10
|
|
|
|
| 15 |
thin rules and small glyphs are easier to read before recognition.
|
| 16 |
|
| 17 |
Explicitly omitted vs the heavy Space build:
|
| 18 |
+
- No text-layer row injection, institution-specific splits (UCB / Navy /
|
| 19 |
+
TD / First Horizon / …), doc-wide dedupe passes, or HTML table rewriting
|
| 20 |
+
keyed off column names / dates / amounts (layout fidelity comes from input
|
| 21 |
+
image quality, not post-hoc string rules).
|
| 22 |
|
| 23 |
Configure GLMOCR_API_KEY (environment variable). Optional: glmocr + gradio +
|
| 24 |
pymupdf + pillow installed.
|
|
|
|
| 72 |
|
| 73 |
# Rasterization: higher scale = more pixels per PDF point (helps small type,
|
| 74 |
# boxed headers, and narrow columns). Same constant for all uploads.
|
| 75 |
+
RENDER_SCALE = 3.05
|
| 76 |
|
| 77 |
# White margin as a fraction of page width/height after render. Extra right
|
| 78 |
# margin helps right-aligned currency columns that hug the page edge.
|
| 79 |
+
PAD_LEFT_FRAC = 0.035
|
| 80 |
+
PAD_RIGHT_FRAC = 0.11
|
| 81 |
+
PAD_TOP_FRAC = 0.018
|
| 82 |
+
PAD_BOTTOM_FRAC = 0.018
|
| 83 |
|
| 84 |
ENABLE_CONTRAST = True
|
| 85 |
# Slight contrast lift only; same factor for every file.
|
| 86 |
+
CONTRAST_FACTOR = 1.16
|
| 87 |
|
| 88 |
# Subtle edge enhancement after contrast (helps hairlines and small digits).
|
| 89 |
ENABLE_UNSHARP = True
|
| 90 |
+
UNSHARP_RADIUS = 0.78
|
| 91 |
+
UNSHARP_PERCENT = 72
|
| 92 |
+
UNSHARP_THRESHOLD = 1
|
| 93 |
|
| 94 |
DEFAULT_ZONE_FRAC = 0.12
|
| 95 |
PDF_HEADER_BAND_FRAC = 0.10
|