DEV Community

El Bruno
El Bruno

Posted on • Originally published at elbruno.com on

#AzureML – Sample 🐍 Python app to consume a image classification Azure Machine Learning HTTP REST Endpoint

Hi !

In my previous post I wrote

  • How to create a custom dataset with images to be used on a Azure Machine Learning Designer project.
  • How to use the custom data set and how to train an image classification model.
  • How to publish the model to be used as a WebService / HTTP REST endpoint.

Each endpoint provides a set of code samples in C#, Python and R. The code is autogenerated, and because we are working with binay images, the generated code will be huge !!! This is because it will include a Base64().toString() serialization of the file.

binary code included on the code sample

Based on the original code, I created a sample code in Python that will read a local file, encode the file and then make the http request.

It works almost without a change, and here is a sample output that also includes a call to the next sample, which process the JSON response, this sample may also help!

azure ml sample client calling endpoint

Tomorrow I'll show a live webcam real-time analysis using the Azure ML Endpoint to detect Squirrels or Space Wolves!

Continue reading #AzureML – Sample 🐍 Python app to consume a image classification AzureML HTTP REST Endpoint

Discussion (0)