HOW TO USE
- Firstly you would need to install Tensorflowjs toxic Modal
npm install @tensorflow/tfjs @tensorflow-models/toxicity
- Import the Modal to : resources /js/bootstrap.js
window.toxicity = require('@tensorflow-models/toxicity');
-
The ValidationController.php contains the Code for making the prediction on the Toxicity Modal
-
The Demo.php contains a front end view as shown below
-
api.php contains the api route
-
how to make the API Call:
require_once get_template_directory() . "/framework/Curl.php";
$url = 'http://bati.local/api/invokeML';
$params = array(
'from'=>get_option('siteurl'),
'word' => ' You Suck',
);
$output = Curl::httpPost($url, "POST", $params);
var_dump($output);
In-order to learn how to make API calls you can look at my ApiCall Repo:: Api Call PHP