Skip to content

Instantly share code, notes, and snippets.

@olokobayusuf
Last active October 26, 2021 21:10
Show Gist options
  • Save olokobayusuf/fde06c0cf36d00f277a57b11ec396c9e to your computer and use it in GitHub Desktop.
Save olokobayusuf/fde06c0cf36d00f277a57b11ec396c9e to your computer and use it in GitHub Desktop.
Running image classification in Python with a NatML Hub predictor.
# Fetch the model data from Hub
model_data = MLModelData.from_hub("@natsuite/resnet152", access_key);
# Deserialize the model # The model is actually being created server-side
model = model_data.deserialize();
# Create the ResNet classification Hub predictor
predictor = ResNetHubPredictor(model);
# Predict
image = PIL.Image.open(...);
label, score = predictor.Predict(image);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment