Skip to content

Instantly share code, notes, and snippets.

@abgoswam
Created January 30, 2023 17:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abgoswam/9896de2e365b1716c9c0eb210c4b42a3 to your computer and use it in GitHub Desktop.
Save abgoswam/9896de2e365b1716c9c0eb210c4b42a3 to your computer and use it in GitHub Desktop.
import * as ort from 'onnxruntime-node';
// use an async context to call onnxruntime functions.
async function main() {
ort.InferenceSession
const session = await ort.InferenceSession.create('./model4.onnx');
// 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();
@abgoswam
Copy link
Author

Standalone TS file works fine. We get the correct scores as output of the model

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment