Color Detector

First thing first



To give birth to this app, we will count on ml5.js which is a library.
This library is the best way to start dealing with artificial intelligence.

Then, we're going to use a function found on ml5js.org called imageClassifier() on which you can find all the information you need by clicking on the following link the official ml5 website. This will allow the AI to recognize the content of an image as if it had created all the colors of the world.

Let's learn how to use the code!




First of all, as you will use content from the library you have to make reference to it in the html sheet the way you can see in the following image :



Next step, you have to create a .js file to include the java code taken from ml5 library.

Our code will have two main parts: the first One will hold the image and the second one will give the result with the highest probability :



If the user wants an app that enables him to submit directly his own image, you will have to use the following code:



To make your app works, you will also have to write in the HTML sheet the things written below:

How it will look like at the end?



And... this is what we finally get! Vert Émeraude ladies and gentlemen !