npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

python-react-ml

v2.0.0

Published

Production-grade Edge AI runtime for React. Orchestrates Pyodide & ONNX in background workers with fault tolerance.

Readme

python-react-ml

Run ML models directly in React and React Native apps with multiple runtime engines - no backend required!

Multi-Runtime Support: Choose between Pyodide (Python), ONNX Runtime, or TensorFlow.js for optimal performance based on your model type and requirements.

Installation

npm install python-react-ml

For React apps, also install:

npm install python-react-ml-react

For React Native apps, also install:

npm install python-react-ml-react-native

Quick Start

React

import { useModel } from 'python-react-ml-react';

function MyMLComponent() {
  // Python model with Pyodide runtime
  const { model, isLoading, error, runInference } = useModel('/python-model.bundle', {
    runtime: 'pyodide'
  });
  
  // Or ONNX model for high performance
  // const { model, isLoading, error, runInference } = useModel('/model.onnx', {
  //   runtime: 'onnx'
  // });
  
  // Or TensorFlow.js model with GPU acceleration  
  // const { model, isLoading, error, runInference } = useModel('/tfjs-model/', {
  //   runtime: 'tfjs',
  //   tfjsBackend: 'webgl'
  // });
  
  if (isLoading) return <div>Loading model...</div>;
  if (error) return <div>Error: {error.message}</div>;
  
  const handlePredict = async () => {
    try {
      const result = await runInference({ 
        input_data: [[1, 2, 3, 4]] 
      });
      console.log('Prediction:', result);
    } catch (err) {
      console.error('Prediction failed:', err);
    }
  };
  
  return (
    <button onClick={handlePredict}>
      Run Prediction
    </button>
  );
}

Runtime Selection

Choose the optimal runtime engine for your specific model and performance requirements:

🐍 Pyodide Runtime

  • Use for: Python scripts, custom ML models, data preprocessing
  • Performance: Good, full Python ecosystem
  • Bundle size: Large (~10MB+)
  • GPU support: No

⚡ ONNX Runtime

  • Use for: Production models, cross-platform compatibility
  • Performance: Excellent, optimized inference
  • Bundle size: Small (~2-5MB)
  • GPU support: Yes (WebGL)

🧠 TensorFlow.js Runtime

  • Use for: Neural networks, TensorFlow models
  • Performance: Excellent with GPU acceleration
  • Bundle size: Medium (~5-8MB)
  • GPU support: Yes (WebGL/WebGPU)
// Specify runtime in useModel options
const { model } = useModel('/model', {
  runtime: 'onnx',        // 'pyodide', 'onnx', or 'tfjs'
  tfjsBackend: 'webgl'    // For TensorFlow.js GPU acceleration
});

React Native

import { useModelNative } from 'python-react-ml-react-native';

function MyMLComponent() {
  const { model, isLoading, error, runInference } = useModelNative('my-model');
  
  // Same usage as React
}

Features

  • 🚀 Zero Backend: Run ML models entirely in the browser/app
  • 🔒 Privacy First: No data leaves the device
  • Fast: Optimized Python runtime with Pyodide
  • 📱 Cross Platform: Works in React web and React Native
  • 🎯 Type Safe: Full TypeScript support
  • 📦 Easy Bundling: CLI tools for model packaging

Documentation

Visit the GitHub repository for full documentation, examples, and guides.

License

MIT