JordanChoo / naughty-node

Serverless Tensorflow.js function that evaluates the toxicity of a term

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Naughty Node

Naughty Node is a severless implementation of Tesnsorflow.js's prebuilt toxicity model for single queries.

Usage

The usage of Naughty Node is quite straight forward, all requests should be sent as GETs with all variables provided as query parameters.

Query Parameters

The following query parameters are used in Naughty Node:

Use Cases

The uses cases for this are genuinely limited by your imagination.

At Kogneta, a few cases for Naughty Node include:

  • Evaluating page content and anchors to identify spammy links
  • Scanning UGC for content that may need to be removed
  • Analyzing customer reviews to identify offensive or explicit ones

... are you using Naught Node in a unique way? Let us know and we'll feature you :)

Deployment

Environment Variables

In order for Naughty Node to work, the following environment variable(s) need to be configured and used:

kgKey

In order to prevent any Joe/Jane Schmo from using your Cloud Function, Naughty Node uses an internal environment key that all requests are checked against. The variable name is called kgKey.

On the request side the kgKey is evaluated as a query parameter in all requests.

Function Configuration

Since Tensorflow.js is quite picky about the hardware and Node.Js versions it is deployed on, I've found that the following Google Cloud Function settings have worked best:

Item Configuration Value
Memory 8 GiB
Runtime Node.js 12
Timeout 120 seconds

About

Serverless Tensorflow.js function that evaluates the toxicity of a term


Languages

Language:JavaScript 100.0%