JSPM

coreml

0.0.1
    • ESM via JSPM
    • ES Module Entrypoint
    • Export Map
    • Keywords
    • License
    • Repository URL
    • TypeScript Types
    • README
    • Created
    • Published
    • Downloads 2
    • Score
      100M100P100Q41189F
    • License MIT

    CoreML bindings for javascript runtimes

    Package Exports

    • coreml
    • coreml/lib.mjs

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (coreml) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    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