Last active
November 29, 2020 15:36
-
-
Save Davisy/dea58bf0f5ac04743f82f6c07f346f3a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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