File size: 1,592 Bytes
553e5b1
 
 
 
 
 
 
 
 
 
 
 
 
75b6a6d
 
13c1c10
 
 
 
75b6a6d
13c1c10
75b6a6d
13c1c10
 
 
 
 
75b6a6d
13c1c10
 
 
 
 
 
75b6a6d
13c1c10
75b6a6d
13c1c10
 
75b6a6d
13c1c10
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
---
title: Xibi Binarization
emoji: 🏆
colorFrom: indigo
colorTo: green
sdk: gradio
sdk_version: 6.14.0
python_version: '3.12'
app_file: app.py
pinned: false
short_description: 'Trying out different binarizations solutions '
---

# Xibi Binarization

Compare document binarization methods side by side. Each method runs independently
with its own tunable parameters. **No silent fallbacks** — if a model fails to load
or run, the UI reports the error so you always see the real result of the method you
picked (or nothing).

## Methods

Classical (CPU, tunable):
- `Sauvola` — local adaptive threshold. Params: window size, `k`, `r`.
- `Niblack` — local adaptive threshold. Params: window size, `k`.
- `Otsu` — global threshold with optional Gaussian pre-blur.
- `Adaptive Gaussian` — OpenCV adaptive mean. Params: block size, `C`.

Neural:
- `Tzefa b5``WARAJA/b5_model` (`HighResMAnet`, smp MAnet + `mit_b5` encoder),
  640px tiled inference, sigmoid probability map. Param: binarization threshold.
  **Gated** — requires an `HF_TOKEN` Space secret with access granted to the repo.
- `SBB ResNet50-UNet``SBB/sbb_binarization`, tf-keras SavedModel, patch-tiled
  pixelwise segmentation. Params: binarization threshold, invert.

## Configuration

- Set the `HF_TOKEN` secret on the Space for the gated Tzefa b5 model.
- `tensorflow-cpu` is used so the SBB model does not contend with torch for GPU VRAM.

Dependencies are listed in `requirements.txt`; system packages in `packages.txt`.

Configuration reference: https://huggingface.co/docs/hub/spaces-config-reference