Running ML models in the browser is now pretty easy with Transfomer.js. In this tutorial, I walk through a very simple JS app that does object recognition client-side!
Code: https://github.com/yacineMahdid/trans...
Table of Content
Introduction: 0:00
Example App: 0:32
index.html: 1:44
style.css: 2:42
index.js: 3:20
file upload event listener: 5:07
detect function: 6:02
drawing boxes: 8:28
where is the magic?: 9:26
Conclusion: 11:18
Making machine learning applications has become easier and easier thanks to better tooling put in place. 🛠️
One of the libraries that I learned about recently is transformer.js. It's pretty mindblowing from a frontend perspective
This open-source library lets you run pre-trained models directly in your browser, client-side.
This has massive benefits:
⊚ Very simple to glue together an application by importing the model weights.
⊚ Less complexity in serving the model to users.
⊚ Frontend people don’t have to understand all the intricacy of the model.
⊚ It can support custom models made in Pytorch, Tensorflow, or JAX!
The only drawback here is that for this structure to work, the model needs
to have a reasonable size since you will be downloading it in the
client's browser.
For a lot of machine learning applications though, this is a very smart choice to get to something useful fast!
#machinelearnign #deeplearning
More information here:
Huggingface:
📌 https://huggingface.co/docs/transform...
Github:
📌 https://github.com/xenova/transformer...
There is also this cool sentiment analysis tutorial you should check out:
📌 / transformers-js-ai-in-the-browser-zero-ser...
----
Join the Discord for general discussion: / discord
----
Follow Me Online Here:
GitHub: https://github.com/yacineMahdid
LinkedIn: / yacinemahdid
___
Have a great week! 👋