evanwashere / coreml.js

cross-runtime javascript library for CoreML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

coreml.js

cross-runtime library for CoreML

Install

bun add coreml

npm install coreml

Example

import { Model } from 'coreml';

const model = new Model('mnist.mlpackage', { units: 'all' });

// inspect input and output types
console.log(model.input);
console.log(model.output);

model.predict({
  image: 'one.jpg',
});

/* -> {
  labelProbabilities: {
    '0': 0.0023670196533203125,
    '1': 0.96533203125,
    '2': 5.960464477539063e-8,
    '3': 0,
    '4': 1.7881393432617188e-7,
    '5': 0.0002435445785522461,
    '6': 0.032470703125,
    '7': 8.940696716308594e-7,
    '8': 1.7881393432617188e-7,
    '9': 0
  },
  classLabel: 1n
} */

License

MIT © Evan

About

cross-runtime javascript library for CoreML

License:MIT License


Languages

Language:Objective-C++ 60.8%Language:JavaScript 39.2%