How to Use Tensorflow.js in React.js - Sentimental Analysis

How to Use Tensorflow.js in React.js - Sentimental Analysis

The ultimate ending of this tutorial is to create a sentimental analysis calculator which can calculate the positivity (1) or negativity (0) of the written sentences. This is particular useful when you need to detect and prevent negative comments in your application. How to Use Tensorflow.js in React.js - Sentimental Analysis

In March 2018, Google announced  Tensorflow.js version 1.0, which enable developer to use machine learning (ML) models directly in browser or in Node.js via JavaScript.

Since then I always want to use those fancy pre-trained model published by google in my project such as o bject detection,  pose estimation and etc. It is however, those example and demo are shown in pure JavaScript and there are a less guide on how to use it in a react application.

Inspired by  Benson Rua code in Tensorflow.js Community  “Show & Tell”. I had decided to write something on using create-react-app + tensorflow.js to encourage more people to join the community:

The ultimate ending of this tutorial is to create a sentimental analysis calculator which can calculate the positivity (1) or negativity (0) of the written sentences. This is particular useful when you need to detect and prevent negative comments in your application.

Image for post

The calculated value is near zero (negative sentences)

1. Setup your Create-React-App

Create a  Create-React-App via the following commands in your terminal:

npx create-react-app tfjs-sentiment
cd tfjs-sentiment

Install tensorflow.js as below:

npm install @tensorflow/tfjs 

and start the app

npm start

sentiment-analysis react reactjs tensorflow

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

Why ReactJS?

React JS is the most popular JS library for building UI (User Interfaces), which is created by Facebook. We can build fast Single Page, modern Applications, or websites with React. So, the question here arises is why React is so important. Let's put some light on the features of react.

Share Code Between React Native and React JS

React provides support for the server-side and frontend. Today, React development services are in demand as more and more organizations are considering software solutions that are crafted from the framework.

Tensorflow Hooks for React.js

Tensorflow Hooks for React.js A library of React hooks and HOCs written in Typescript to use Tensorflow models in your application!

Top ReactJS Development Company in USA - Hire React JS Developers

Hire ReactJS developers from a Top ReactJS Development Company in USA to developing User Interfaces on ReactJS framework.