gitmyhub

tfjs

TypeScript ★ 19k updated 1d ago

A WebGL accelerated JavaScript library for training and deploying ML models.

TensorFlow.js lets you run machine learning models directly in a web browser or Node.js using JavaScript, so AI features work on the user's device without sending data to a server.

TypeScriptJavaScriptWebGLWebAssemblyWebGPUNode.jssetup: easycomplexity 3/5

TensorFlow.js brings Google's machine learning framework to JavaScript, letting you build, train, and run AI models directly in a web browser or in Node.js — no Python server required. Machine learning (ML) usually lives on a back-end server in Python, but TensorFlow.js moves that capability to wherever JavaScript runs, including right inside a user's browser tab.

It works by tapping into the browser's graphics hardware via WebGL (the same technology used for 3D games) to run AI calculations at speed. There are also backends for WebAssembly (a fast, near-native execution format) and WebGPU for even newer devices. You can write models from scratch using a low-level math API, use a Keras-style layers API for a simpler experience, or load a model already trained in Python and run it directly in the browser without conversion.

You would reach for TensorFlow.js when you want real-time AI features — like object detection through a webcam, text classification, or pose estimation — that must work in the browser with no server round-trip. It is also useful for protecting privacy, since the user's data never leaves their device. The library is written in TypeScript, installable via NPM, and compatible with React Native as well as standard web environments.

Where it fits