像查询数据库一样优雅调用百度,face++,腾讯优图人工智能 API

laravel使用方法

  1. 根目录下执行:
    composer require hahaxixi/ai
  2. 项目目录config下面添加配置文件ai.php,内容如下
    return [
            'face_plus' => [...],
                    'baidu' => [...],
                    'youtu' => [...],
    ];
  3. 一行代码调用人脸检测示例

    $result = Entry::Baidu(config('ai'))->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();
  4. 项目地址:
    https://github.com/huanghe/ai

  5. 提供百度API测试账号一枚:
    'baidu' => [
        'app_id' => '10542071',
        'app_key' => '8s6SsRRSqSEBGbHET5yQWWgT',
        'secret_key' => 'AYBUKYByCBDdaSWijinZl24WZnbCpAtt',
    ],