Skip to content

Instantly share code, notes, and snippets.

@steerapi
Last active November 2, 2018 23:06
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 steerapi/3d1c9aaaa1ae8a441a84f6a306a2c495 to your computer and use it in GitHub Desktop.
Save steerapi/3d1c9aaaa1ae8a441a84f6a306a2c495 to your computer and use it in GitHub Desktop.
const model = new ModelDescriptor({
modelId: 'QmZ9db8JzNCNrKuYyFN4Sv3a4Rn9CgZM99owJXwFjUhCik',
modelPath: 'https://cloudflare-ipfs.com/ipfs/QmZ9db8JzNCNrKuYyFN4Sv3a4Rn9CgZM99owJXwFjUhCik', // resnet18 pytorch model
modelType: 'torchjs/cuda'
});
await node.initModel(model)
node.inferModel(model, inputs).on('response', (outputs, confidences, finish) => {
// Do something with the outputs, confidences
// call finish() to finish the computation if outputs are already highly confidence
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment