To use TensorFlow for application

  1. Web applications include backend dango and nodejs. What are the advantages of deploying AI services?

  2. There is TensorFlow.js, but isn’t typescript used much? What script do recommend? Considering the framework of Django and Nodejs.

Thanks for posting.

  1. If you are asking advantages of using server side web machine learning in say Node or Django then the answer is usually the following:

a) You can run models as large as your system resources allow. Maybe you have a model thats 50GB in size - clearly it does not make sense to run that on the client side in most cases.

b) You know the environment you will run in. If you own the server you can choose what GPU/CPU / RAM to pay for and have available to you. If you run on the client side you do not know what device it may execute on so users will have varying performance experiences based on their device capabilities.

  1. TensorFlow.js is Google’s open sourced machine learning library for JavaScript developers. If you are looking to execute in the web browser directly to get advantages like privacy, lower cost (no server GPUs to hire), lower latency, and the reach and scale of the web (anyone can try the demo by just going to the link with no need to setup and install dependencies etc) then TensorFlow.js is the only offering we have at Google to do that. TensorFlow.js is written in TypeScript and transpiled to JavaScript as 70% of the world’s developers use JS in production. Also JS is the language of web browsers when you execute client side so you must convert the Typescript to JS to execute ultimately.

On the backend TensorFlow.js can run via Node.js.

Both Python and Node are just wrappers around C++ for server side execution, so in that respect they run at the same speed for model interference, however if you include the pre/post processing code that you write in your native language of choice, then Node.js generally can be faster than Python as detailed in these 2 write ups:

1 Like

Regardless of the speed difference being compiled in C language, Django is a well-known framework, but is Nodejs still better?

Choose whatever you are most confident in. 52% of developers use Node so they may choose Node. If you are Python person then choose Python. Also right now the Python ecosystem is more mature on the server side than Node is as JS devs are just getting into the ML space, so if you need to make use of some of those more advanced features then Python may be better for you. That may change with time though and we are seeing many popular models being ported to run on the JS stack to get the benefits of the JIT compiler of Node like the case studies above. When you are a large company like LinkedIn 10-15% extra perf boost can mean serious $$ in cost savings.

1 Like