200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > 腾讯开发平台php 腾讯AI开放平台 Tencent AI open platform

腾讯开发平台php 腾讯AI开放平台 Tencent AI open platform

时间:2021-08-03 03:34:31

相关推荐

腾讯开发平台php 腾讯AI开放平台 Tencent AI open platform

腾讯AI开放平台 SDK

Tencent AI open platform sdk

Special thanks to the generous sponsorship by:

Requirement

PHP >= 7.0

ext-curl 拓展

ext-json 拓展

安装

composer require justmd5/tencent-ai

使用

$config = [

'appKey' => '1106944xxx',

'appSecret' => 'dsgnbnWnX8Yxxxxxx',

'debug' => true,//true show debug info

];

$AI = new \Justmd5\TencentAi\Ai($config);

接口调用示例

$params = [

'question'=>'腾讯人工智能',

'session'=>123,

];

try {

dd($AI->nlp->request('textchat', $params));

} catch (\Justmd5\TencentAi\Exception\NotFoundException $e) {

dd($e);

}

$params = [

//image 支持两种传递参数方式

// 'image' => base64_encode(file_get_contents(__DIR__ . '/1571126902_843200.jpg')),//old

'image' => __DIR__ . '/1571126902_843200.jpg',//new

'session_id' => time(),

];

try {

var_dump($AI->vision->request('imgtotext', $params));

} catch (\Justmd5\TencentAi\Exception\NotFoundException $e) {

print_r($e->getMessage());

} catch (\Justmd5\TencentAi\Exception\IllegalParameterException $e) {

print_r($e->getMessage());

}

文档

帮助

qq群

Todo

parameter verify

感谢

源码列表

License

MIT

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。