在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:tencent-ai开源软件地址:https://gitee.com/khs1994-php/tencent-ai开源软件介绍:Tencent AI SDK微信订阅号关注项目作者微信订阅号,接收项目最新动态 InstallationTo Use Tencent AI SDK, simply: $ composer require khs1994/tencent-ai For latest commit version: $ composer require khs1994/tencent-ai dev-master Usage<?phprequire __DIR__.'/vendor/autoload.php';use TencentAI\TencentAI;use TencentAI\Exception\TencentAIException;const APP_ID = 1106560031;const APP_KEY = 'ZbRY9cf72TbDO0xb';# you can set return format and request timeout$ai = TencentAI::getInstance(APP_ID, APP_KEY, false, 10);$image = __DIR__.'/path/name.jpg';// must try-catch exceptiontry { $result = $ai->face()->detect($image);} catch (TencentAIException $e) { $result = $e->getExceptionAsArray();}// default return arrayvar_dump($result); Laravel$ php artisan vendor:publish --tag=config Then edit config in <?phpuse TencentAI;use TencentAI\Exception\TencentAIException;$image = __DIR__.'/path/name.jpg';try { // call by facade $result = TencentAI::face()->detect($image); // call by helper function // tencent_ai()->face()->detect($image);} catch (TencentAIException $e) { $result = $e->getExceptionAsArray();}// default return arrayvar_dump($result);// use DIclass AI{ public $tencent_ai; public function __construct(\TencentAI\TencentAI $tencent_ai) { $this->tencent_ai = $tencent_ai; } public function demo() { $image = __DIR__.'/path/name.jpg'; return $this->tencent_ai->face()->detect($image); }} Who use it?PHP CaaSPowered By khs1994-docker/lnmp |
请发表评论