Downloads · 30 days
0
cwLeeDev/AIFlow-Math-Ink-0.5
AIFlow-Math-Ink-0.5 is a image-to-text model from cwLeeDev. Use it when you need a caption or text from an image. It is set up for aiflow-math-ink. The card lists the license as apache-2.0.
AIFlow Math Ink 0.5 is a model-agnostic geometric gridding layer for online handwritten mathematics. It converts ordered pen strokes into spatially coherent formula cells and renders one clean image per cell.
Downloads · 30 days
0
Access
Public
Updated Jul 25, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py15.8 KB · 35%
From the Hugging Face model README
AIFlow Math Ink 0.5 is a model-agnostic geometric gridding layer for online handwritten mathematics. It converts ordered pen strokes into spatially coherent formula cells and renders one clean image per cell.
This repository contains no OCR model, model weight, tokenizer, training data, or generated prediction. It is a deterministic preprocessing layer only.
The output images can be passed to any image-to-LaTeX recognizer. They are interface-compatible with TexTeller-style image batches, but TexTeller is not included, redistributed, modified, or required by this repository.
An image-to-LaTeX model normally expects one coherent expression image. A pen canvas may instead contain multiple rows, detached superscripts, fractions, or matrix delimiters. AIFlow Math Ink 0.5 uses the original stroke geometry to partition that canvas before recognition.
The layer:
This is a transparent heuristic algorithm, not a trained neural-network layer.
pip install Pillow
Clone this repository and add src to your Python path, or install it locally:
pip install -e .
from PIL import Image
from aiflow_math_ink_05 import GridConfig, Stroke, build_formula_grids, render_grid_images
strokes = [
Stroke(0, ((24, 20), (36, 20)), 3.0),
Stroke(1, ((10, 42), (60, 42)), 3.0),
Stroke(2, ((24, 64), (36, 64)), 3.0),
]
grids = build_formula_grids(strokes, GridConfig())
images = render_grid_images(Image.new("RGB", (80, 90), "white"), strokes, grids)
for grid, image in zip(grids, images, strict=True):
print(grid.stroke_ids)
image.save(f"cell-{grid.index}.png")
For an existing API payload, use parse_writing_events() before
build_formula_grids(). See examples/basic.py.
render_grid_images() returns ordinary RGB PIL.Image.Image objects. A
recognizer can consume the list as a batch without importing this package into
its model implementation. TexTeller compatibility means only this image-level
interface; no TexTeller component is included.
The complete method, equations, assumptions, and limitations are documented in
docs/METHOD.md.
For (n) accepted strokes, pair construction is (O(n^2)), disjoint-set operations are effectively near-linear, and rendering is proportional to the number of retained points plus output pixels. Input caps are mandatory in server environments; the parser defaults to 2,000 strokes and 200,000 total points.
The original code in this repository is licensed under Apache License 2.0. Pillow is an install-time dependency and is not vendored. External recognizers are separate works governed by their own licenses.