Clarifai

Clarifai

  • Category: Machine Learning


Working with CLARIFAI's Public APIs:

CLARIFAI offers a suite of powerful APIs that can perform various computer vision tasks on images and videos - tagging and detecting objects, faces, and more. In this blog post, we will explore the CLARIFAI APIs and learn how to use them using JavaScript.

Getting started:

Before we can start using the CLARIFAI APIs, we will need to create an account on their developer portal and create an API key. Once the API key is generated, we can start using the APIs.

Installing the CLARIFAI JavaScript SDK:

To make it easier to interact with the CLARIFAI APIs, we can use the official CLARIFAI JavaScript SDK. To install it, run the following command using npm:

npm install clarifai --save

Using the CLARIFAI APIs:

The CLARIFAI API provides different models to perform various tasks. Let's take a look at some of the most commonly used models:

Tagging Images using the General Model:

The General Model is used to tag images with concepts that are present in the image. To use this model, we first need to load the model using the CLARIFAI JavaScript SDK, as shown below:

const Clarifai = require('clarifai');
const app = new Clarifai.App({apiKey: 'YOUR_API_KEY_HERE'});

// Load the General Model
app.models
  .initModel({id: Clarifai.GENERAL_MODEL})
  .then(generalModel => {
    console.log('General Model Loaded!');
  })
  .catch(err => {
    console.error(err);
  });

Once the General Model is loaded, we can use it to tag an image by providing the image URL, as shown below:

// Tag an Image
app.models
  .predict(Clarifai.GENERAL_MODEL, 'https://samples.clarifai.com/metro-north.jpg')
  .then(response => {
    const concepts = response.outputs[0].data.concepts;
    console.log(concepts);
  })
  .catch(err => {
    console.error(err);
  });

In the above example, concept is an array of objects that contains information about the concepts present in the image.

Detecting Faces using the Face Detection Model:

The Face Detection Model is used to detect faces in an image. Similar to the General Model, we first need to load the Face Detection Model, as shown below:

// Load the Face Detection Model
app.models
  .initModel({id: Clarifai.FACE_DETECT_MODEL})
  .then(faceDetectModel => {
    console.log('Face Detection Model Loaded!');
  })
  .catch(err => {
    console.error(err);
  });

Once the Face Detection Model is loaded, we can use it to detect faces in an image by providing the image URL, as shown below:

// Detect Faces in an Image
app.models
  .predict(Clarifai.FACE_DETECT_MODEL, 'https://samples.clarifai.com/face-det.jpg')
  .then(response => {
    const regions = response.outputs[0].data.regions;
    console.log(regions);
  })
  .catch(err => {
    console.error(err);
  });

In the above example, regions is an array of objects that contains information about the regions where faces were detected in the image.

Conclusion:

The CLARIFAI APIs provide powerful computer vision capabilities that can be leveraged to build intelligent applications. In this blog post, we explored how to use CLARIFAI APIs in JavaScript to tag images and detect faces, using the General Model and the Face Detection Model.

Visit to Clarifai website

Similar APIs of Machine Learning

Blogcast

Blogcast

Machine Learning

Generate realistic voice overs for blogs, videos, podcasts and more using AI text-to-speech technology. No microphone required! Blogcast is an AI-powered text-to-speech technology that has zero waiting for no involvement of humans. It is fully automated podcast with endless possibilities. With blogcast you can enhance WordPress posts, Medium articles, and website content with audio to expand your reach. Quickly create voice over tracks for YouTube videos without hiring expensive talent. Generate podcast episodes as new articles are posted. Explain concepts and provide audio for courses and online training. Add audio to product explainers, demos, and support materials. Publish audio chapters from existing book content.

textspeechword

Houndify

Houndify

Machine Learning

Integrate voice and conversational intelligence into your products through an independent AI platform that is always learning. Our Speech-to-Meaning® engine delivers unprecedented speed and accuracy, while our Deep Meaning Understanding™ technology allows users to ask multiple questions and filter results all at once. With custom wake words and custom domains, you maintain your brand and you keep your customers. It's that simple. Some of the prominent companies using this system are Honda, Mercedez Benz, Snap Inc, Pandora, KIA & Harman.

textspeechvoice

Base64.ai

Base64.ai

Machine Learning

Base64.ai document processing AI can instantly process over 500+ document types, including IDs, driver licenses, passports, visas, vehicle registrations, insurance cards, and invoices, commonly used by the gig economy, governments, airlines, and banks. Our technology can automate existing manual data entry processes without the need for model training, senior ML engineers, or infrastructure. Base64.ai face recognition & matching AI can help you prevent user fraud by instantly comparing the user's selfie with their ID, driver's license, passport, or visas.

RPAprocessdocument

Cleverbot API

Cleverbot API

Machine Learning

Chat with a bot about anything and everything - AI learns from people, in context, and imitates. The Cleverbot API is RESTful. You call a URL on our server and we return JSON.

MachineChatChat

Face API JS

Face API JS

Machine Learning

JavaScript API for face detection and face recognition in the browser and nodejs with tensorflow.js. Using this API, you can predict the age, color and probable accuracy ration. Demo projects are placed inside the link.

FaceRecognitionAge

Landmark Recognition

Landmark Recognition

Machine Learning

With ML Kit's landmark recognition API, you can recognise well-known landmarks in an image. When you pass an image to this API, you get the landmarks that were recognized in it, along with each landmark's geographic coordinates and the region of the image the landmark was found. You can use this information to automatically generate image metadata, create individualized experiences for users based on the content they share, and more.

imagemachineengineering

Text Recognition

Text Recognition

Machine Learning

With ML Kit's text recognition APIs, you can recognise text in any Latin-based language. Text recognition can automate tedious data entry for credit cards, receipts, and business cards. With the Cloud-based API, you can also extract text from pictures of documents, which you can use to increase accessibility or translate documents. Apps can even keep track of real-world objects, such as by reading the numbers on trains.

Textreadingreceipts

Face Detection with Firebase

Face Detection with Firebase

Machine Learning

With ML Kit's face detection API, you can detect faces in an image, identify key facial features, and get the contours of detected faces. With face detection, you can get the information you need to perform tasks like embellishing selfies and portraits, or generating avatars from a user's photo. Because ML Kit can perform face detection in real time, you can use it in applications like video chat or games that respond to the player's expressions.

FaceDetectionFirebase

Image Labeling

Image Labeling

Machine Learning

With ML Kit's image labeling APIs, you can recognize entities in an image without having to provide any additional contextual metadata, using either an on-device API or a cloud-based API.

Imagepeoplethings

Skybiometry

Skybiometry

Machine Learning

Detect faces at various angles. Detect multiple faces in a photo simultaneously. With or without glasses. With any expression.

BiometricsVerificationEmotion