$text
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
$response = curl_exec($ch);
if (curl_errno($ch)) {
$prediction = "Error: " . curl_error($ch);
} else {
$prediction = json_decode($response, true);
}
curl_close($ch);
}
?>
Hate Speech Detector
Hate Speech Detector
Prediction: $label ($score%)";
} else {
echo "
".htmlspecialchars(json_encode($prediction))."
";
}
}
?>