rehan953 commited on
Commit
d501982
·
verified ·
1 Parent(s): 0d5691f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
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 HTML table rewriting, text-layer row injection, institution-specific
19
- splits (UCB / Navy / TD / First Horizon / …), or doc-wide dedupe passes
 
 
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 = 2.85
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.03
78
- PAD_RIGHT_FRAC = 0.10
79
- PAD_TOP_FRAC = 0.015
80
- PAD_BOTTOM_FRAC = 0.015
81
 
82
  ENABLE_CONTRAST = True
83
  # Slight contrast lift only; same factor for every file.
84
- CONTRAST_FACTOR = 1.12
85
 
86
  # Subtle edge enhancement after contrast (helps hairlines and small digits).
87
  ENABLE_UNSHARP = True
88
- UNSHARP_RADIUS = 0.85
89
- UNSHARP_PERCENT = 65
90
- UNSHARP_THRESHOLD = 2
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