Created
January 31, 2023 16:27
-
-
Save abgoswam/9f62d9e727353a6eaa3d4cea53d09a55 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as ort from 'onnxruntime-web'; | |
// use an async context to call onnxruntime functions. | |
async function main() { | |
ort.InferenceSession | |
const session = await ort.InferenceSession.create('./model4.onnx', { | |
executionProviders: ["wasm"], | |
}); | |
// prepare feeds. use model input names as keys. | |
const feeds = { | |
float32_input: new ort.Tensor('float32', new Array<number>(221).fill(1), [1, 221]), | |
}; | |
const model_outputs = await session.run(feeds); | |
let probabilityAccept = Number(model_outputs['probabilities']['data'][1]); | |
console.log(probabilityAccept); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
running the above snip is successful: