composer require "crisen/ai":"^1.0.0"
use Crisen\AI\AI;
...
//百度ai
$baiduConfig = [
'app_id' => 'your appid',
'api_key' => 'your api key',
'secret_key' => 'your secret key'
];
$ai = AI::baidu($baiduConfig);
//腾讯ai
$tencentConfig = [
'app_id' => 'your appid',
'app_key' => 'your secret id',
];
$ai = AI::tencent($tencentConfig);
// 图片检索
$url = 'http://aip.bdstatic.com/portal/dist/1543924308745/ai_images/logo.png';
$res = $ai->face()->url($url)->detect();
if($res->success()){
var_dump($res->toArray())
}else{
var_dump($res->getErrMsg());
}