Skip to content

Instantly share code, notes, and snippets.

@olokobayusuf
Last active November 9, 2021 22:53
Show Gist options
  • Save olokobayusuf/7535d32ae602cc08d91aa94f29cb3f22 to your computer and use it in GitHub Desktop.
Save olokobayusuf/7535d32ae602cc08d91aa94f29cb3f22 to your computer and use it in GitHub Desktop.
Running image classification in NodeJS with a NatML Hub predictor.
// Fetch the model data from Hub
const modelData = await MLModelData.fromHub("@natsuite/resnet152", accessKey);
// Deserialize the model // The model is actually being created server-side
const model = modelData.deserialize();
// Create the ResNet classification Hub predictor
const predictor = new ResNetHubPredictor(model);
// Predict
const image = new MLImageFeature(...);
const [label, score] = await predictor.predict(image);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment