AI has become prevalent in recent times, but have you ever tried running an AI model in your local machine using JavaScript? Let’s explore how to deploy AI models locally using Huggingface.js.
Pre-requisites:
- Node.js installed on your machine
npm i @huggingface/inference
npm install node-fetch
- Create an account at Hugging Face
What is Hugging face?
Hugging Face can be likened to the GitHub of machine learning, allowing developers to upload, find, and download pre-trained AI models for various tasks like image-to-text, text-to-image, and text-to-text.
Machine Learning
Machine learning involves training a model to understand and predict patterns in data. For example, we can train a model to recognize hand gestures for games like rock, paper, scissors.
In traditional programming, defining rules for AI can be challenging due to variations in gestures and appearances. However, with machine learning, models can learn from data to make accurate predictions.