Can H2O be used with node.js (standalone/offline in Electron app) - node.js

Does h2o-3 have node.js bindings? I found https://github.com/h2oai/h2o.js but when I saw no updates in two years I realized it was for h2o v2.
I'm specifically asking about deploying a POJO/MOJO jar file, in the context of an Electron app. I.e. offline, not using the REST API to communicate back to a server. (Maybe my question is more: could I use the h2o.jar, and a pojo/mojo file, with something like https://github.com/joeferner/node-java and expect everything to work together, across each of Linux/Mac/Windows?)
FWIW, TensorFlow integration seems vapourware at the moment: https://github.com/node-tensorflow/node-tensorflow, but MxNet seems to have something working: https://github.com/dmlc/mxnet.js/ So, if H2O pojo/mojo can be used from within node.js apps, could Deep Water models also work?

H2O does not have node.js bindings, but H2O exposes a well documented REST API. From Electron, you can start H2O using the child_process module, then talk to H2O using the REST API. If you only care about embedding the model in your Electron app, you can self host the model in a java process using node-java (if you are building some kind of a desktop-only application), OR you can have the Electron app talk to a local or remote http server that hosts the model (see https://github.com/h2oai/app-consumer-loan)

Related

Is Remix.run not using node.js as backend?

I'm very stoked about Remix.run, but there's one thing I really don't get. In the technical explanation of the Framework it says:
While Remix runs on the server, it is not actually a server. It's just a handler that is given to an actual JavaScript server.
It's built on the Web Fetch API instead of Node.js. This enables Remix to run in any Node.js server like Vercel, Netlify, Architect, etc. as well as non-Node.js environments like Cloudflare Workers and Deno Deploy.
So.. is the backend a Node.js server or not? If not.. how can it execute JS in the backend? I think it a bit contradictory in the above explanation.
Remix is build with a lot of different adapters (not sure if that is the official term, but the idea of adapter is fitting). This allows remix to swap out parts of its architecture to make Remix "fit". Examples of those adapter packages are remix-vercel, remix-express, and so on. They all serve te purpose of converting the different interfaces of the requests/events on those platforms to the request/response model of Remix (thus fetch).
All the previous mentioned adapters are Node-based environments, but Remix also has some adapters for non-node environments. For example remix-clouflare-workers is an adapter designed to make the Cloudflare Workers environment play nice with Remix. Cloudflare Workers are not running on Node, in fact its not even a server but just javascript functions being triggered by events. Workers are running directly on the V8 Javascript Engine, the engine that is used by Chrome and Node to run JavaScript.
So yes, Remix can run in NodeJS environments as a server, but because of its adapter architecture, it can also provide adapters for non NodeJS environments, and be (serverless) functions, etc.
Fun fact, even remix-react is a seperate package (adapter), allowing the Remix team (or community) to implement adapters for other front end frameworks in the future!

Is Express.js necessary in learning Node.js?

Most books on Node.js have Express.js sections. Most Node tutorials I've seen are about web development with Node and Express. So, is the knowledge of Express required for a deep understanding of Node?
No, It isn't,
ExpressJs is framework build on top of nodejs, as they are many framework in different programming language it is the same for Javascript in the backend side.
Here is some of example of Framework
Loopback
Sails.js
Koa
Express
In the nodejs world ExpressJS is the popular one, so in many books it's normal to talk about It, as Javascript was firstly build for the web.
But NodeJS can be use for so many kind of application like
Data Streaming Apps
Server-Side Proxy
Big Data Analytics
Wireless Connectivity
System Monitoring Dashboard
Chatbots
And other many sort of application.
In the web world ExpressJS is the popular one.
So you don't have to learn ExpressJS to deep undestand nodejs. And you don't have to learn it if you would not build web application or API. You can also rely packages shiped with nodejs to build any sort of application even web application but it will take you more time than using existing package.]
You can search for any sort of package at NPM
no, a framework is never necessary to learn the language but the opposite, Learning the language is absolutely necessary to learn the framework.
According to express.js: "Express is a minimal and flexible Node.js web application framework that provides a robust set of features for web and mobile applications." thats all.

Is there a way of transporting a pickle file of machine learning written in python (scikit-learn) into node.js?

I would like to use python just for creating machine learning models and then transporting them onto the web using JS. I've done a simple project similar to this, but I used Flask for simple backend/API.
I'm also okay with creating APIs in Flask or Django, and then doing backend in Node.js, if that is possible. I've never done backend before, and my knowledge of frontend and ml is on beginner level.
I would like to build a good and scalable web application that uses ml for It's calculations.
I would like to use Bootstrap for looks, JS for both frontend (React) and backend (Node.js), and Python (Scikit-learn) for machine learning algorithms.
Any suggestions of file structure, organization and which libraries and programming languages I should use are welcome. You can checkout my code and app in links. It isn't anything special, but it works, and I want to build on it.
http://alumil-alloys.herokuapp.com/
https://github.com/nemanjaKostovski/MLmodel
PS what I especially don't like about my app is Flask affecting the frontend. I don't like my html markings for displaying answer.

How to deploy Deep Learning Model(Python) to web app(Node)

Hi I am very interested in machine learning.
familiar with keras and tensorflow and know how to train model and save it.
I want to build node.js(loopback) web application that provides machine learning API.
I'm quite new to web application and don't know how to utilize python code in the node app.
To be specific, I'm trying to make deep style application like this site for practice purpose.
For codes that is open to public in github. most starred implementation is in torch and
I am currently looking (TF).
It has script work as "main.py" that consists of
1) loading pretrained VGG model(about 500Mb) to memory.
2) and using each framework's function, it create output photo inside folder
So I want to run this with GPU instance in AWS
problem is, I don't know how to call "main.py" inside javascript.
Q1 How did many machine learning based services achieved this??
did they implement their server in python like django to load trained model and inference from it?
But I want to integrate in node.js especially loopback. how can I achieve this in a most efficient and common way??
Q2 Is calling "main.py" efficient whenever there's request to server?
I mean, If the script is called everytime request is made, It loads 500Mb object to memory all the time and that's so inefficient.
and as far as I know AWS GPU instance can utilize 4 GPU at a time. I wonder how can I utilize all of it with most efficient and common way...
Thank you for reading!
I'm too frustrated with myself... I really want to know method deploy my model to server
and thank you in advance
You can communicate between NodeJS and e.g. Django with a REST interface. Deploy a Django server with the REST framework and call an url from NodeJS. This way, you can trigger the python code. You can also let the python code call your NodeJS with another REST interface on the javascript side if that is needed.

Port Node.js/Express.js + MongoDB Application to Desktop

I have recently started the development of an App that was intended for the web, using Express.js + MongoDB to define a RESTFull Interface, all this is coupled with an HTML5 frontend that uses AJAX to receive and write data.
The first couple of beta-testers reported that they'd not be ok with the app being a web-application and would much rather have everything on their own computer for security reasons (personal data is handled).
Now, I know that there are a couple of ways to make a Node.js application appear like a native app see Packaging a node.js webapp as a normal desktop app [closed]. I already tried NW.js but I can't seem to find an option to actually run the express.js part of the application within the limits of NW.js.
To my questions:
Is there a way to run a restful api programmed with node & express
within NW.js?
Is it possible to run MongoDB inside that container?
If both or either one are not true, is there a framework that supports
running express & mongodb as a desktop application with my app?
I would focus the effort you would put into porting your app into making those same customers feel comfortable with your security measures for protection their data in the existing web-application format.
But if you really want them to run it locally then they probably need their own Mongo installed. Instead of a full blown mongo install I found NeDB. It implements the same Mongo api's so you should be able to port easily.
https://github.com/louischatriot/nedb
Embedded persistent or in memory database for Node.js, nw.js, Electron
and browsers, 100% Javascript, no binary dependency.

Resources