detypify-service
v0.3.0
Published
Typst symbol classifier
Maintainers
Readme
Detypify Service
Integrate Detypify into your own projects.
Example
import { Detypify, inferSyms } from "detypify-service";
const session = await Detypify.create();
const storkes = [[[0, 0], [1, 1]]];
const scores = await session.infer(strokes);
const candidates = Array.from(scores.keys());
candidates.sort((a, b) => scores[b] - scores[a]);
console.log(inferSyms[candidates[0]]);API Reference
ortEnv: Re-export ofonnxruntime-web.env. Used to configure onnxruntime.Note: Recent
onnxruntime-webbuilds ship bundled wasm by default; use theonnxruntime-web-use-extern-wasmexport condition to opt into external wasm loading (see the officialexportsin https://github.com/microsoft/onnxruntime/blob/main/js/web/package.json).inferSyms: Model's output symbol data.contribSyms: Mapping from Typst symbol names to characters.Detypify: The main type.Use
Detypify.create()to create an instance.Use
instance.infer(strokes)to inference scores of each symbol.The higher
scores[i]is, the more likely your strokes isinferSyms[i].
