xibi_binarization / README.md
Xbits's picture
Rework binarization methods: real tunable params, no silent fallbacks
13c1c10

A newer version of the Gradio SDK is available: 6.15.2

Upgrade
metadata
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 b5WARAJA/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-UNetSBB/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