Skip to content

Instantly share code, notes, and snippets.

@Davisy
Last active November 29, 2020 15:36
Show Gist options
  • Save Davisy/dea58bf0f5ac04743f82f6c07f346f3a to your computer and use it in GitHub Desktop.
Save Davisy/dea58bf0f5ac04743f82f6c07f346f3a to your computer and use it in GitHub Desktop.
<?php
use Algorithmia;
// perform spam detection
public function detect(Request $request){
// valaidate the input
$this->validate($request, [
'message' => 'required|string|min:25',
]);
//collect the message
$message = $request["message"];
// Add client and call the API
$client = Algorithmia::client("YOUR-API-KEY");
$algo = $client->algo("Davis/spam_detection/0.2.0");
// perform prediction and save result
$result = $algo->pipe($message)->result;
return view('sms_spam_result',compact(['message','result']));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment