Skip to content

Instantly share code, notes, and snippets.

@martzcodes
Created May 5, 2019 16:15
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
import * as toxicity from "@tensorflow-models/toxicity";
// ...
toxicity.load(threshold, []).then(model => {
console.log("toxicity model loaded");
this.toxicityModel = model;
});
// ...
return this.toxicityModel.classify(textToAnalyze).then(predictions => {
console.log("Predictions:", predictions);
this.predictions$.next(predictions);
this.analyzing$.next(false);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment