What if your React app could run sentiment analysis, image classification, and semantic search without ever calling an API?
A new open-source library called react-zero-ai does exactly that. It wraps Hugging Face's Transformers.js in a set of React hooks that run machine learning inference (the process of feeding data through a trained model to get predictions) entirely in the user's browser using Web Workers (background threads that keep the UI responsive while crunching numbers).
The library ships four hooks today: useSentimentAnalysis for detecting emotion in text, useEmbeddings for semantic similarity search across arrays of content, useImageClassifier for labeling images, and useObjectDetection for finding and locating objects within images with bounding boxes. Each hook returns a simple async function and a loading state. You can swap in any Hugging Face model with a single config option.
The privacy angle is the real selling point. Because nothing leaves the browser, this is immediately useful for apps handling medical records, financial data, or anything with PII. No API keys, no billing, no rate limits. The tradeoff is that you're limited by the user's device - a phone running a vision transformer will be slower than a GPU-backed API call.
Setup requires cross-origin isolation headers (for SharedArrayBuffer support) and some Vite configuration, though the library handles the Web Worker threading automatically. Next.js and Webpack support are listed as coming soon.
The project is early - 14 commits, MIT licensed, 99.9% TypeScript. It's a solid proof of concept for the growing trend of pushing ML to the edge. For React developers building privacy-sensitive features, it's worth a look. For production apps needing reliable performance across devices, you'll want to benchmark carefully before committing.