• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

tencent-ai: Tencent AI SDK

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

tencent-ai

开源软件地址:

https://gitee.com/khs1994-php/tencent-ai

开源软件介绍:

Tencent AI SDK

GitHub stars PHP from Packagist GitHub (pre-)release Build Status StyleCI codecov

微信订阅号

关注项目作者微信订阅号,接收项目最新动态

Installation

To 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 config/tencent-ai.php

<?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 CaaS

Powered By khs1994-docker/lnmp


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap