/ai

一行代码调用百度,face++,腾讯优图人工智能API

Primary LanguagePHP

Develop documents

开发文档

Support platform

1.百度AI开放平台

2.腾讯AI开放平台

3.FACE++AI开放平台

Feature

  • 统一主流AI平台SDK调用方法;
  • 像查询数据库一样优雅调用API;

Installation

composer require hahaxixi/ai

Usage

$config = [
    'baidu' => [
        'app_id' => '10489***',
        'app_key' => 'H3IUUHlkLibdo3ywdGF***',
        'secret_key' => 'SV3TRWfPakOL010uOthiaD***',
    ],
    'youtu' => [
             'app_id' => '1011***',
             'secret_id' => 'AKIDIROBe3bk2MadU9oDe1Rks***',
             'secret_key' => 'tlYRLAnE8wZBqQoZDh0GGKJF***',
             'user_id' => 269548****
    ]
    'face_plus' => [
                'api_key' => 'txLCeDRVAPl3BgQtvKlPO2HMw***',
                'api_secret' => 'ZICErqEtel-4448WsRu2GV***',
    ],
];

//百度
$result = Entry::Baidu($config)->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();
//腾讯优图
$result = Entry::Youtu($config)->face->select('detectface')->where(['url' => 'http://open.youtu.qq.com/app/img/experience/face_img/face_06.jpg', 'mode' => 1])->get();
//face++
$result =  Entry::FacePlus($config)->face->select('detect')->where(['image_file' =>__DIR__ . '/../../file/face_01.jpg' , 'return_attributes' => 'skinstatus'])->get();

License

Apache License Version 2.0 see Apache License