6 Star 9 Fork 8

river / AI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README

Recent Test

  • 所有API在2018-01-11通过测试

Develop documents

开发文档

Feature

  • 统一AI平台SDK调用方法;
  • 像查询数据库一样优雅调用API;
  • 所传参数和原平台开发文档保持一致,节约开发者学习成本

Support platform(支持的平台)

1.百度AI开放平台

2.腾讯AI开放平台

3.FACE++AI开放平台

SimpleTest

  1. 下载zip包 或者clone本项目

  2. 进入本项目根目录,执行composer install,(包管理工具composer

  3. 在项目目录tests->config下面添加配置文件ai.php(需要自己到各平台注册获取试用账号),内容如:

    return [
        'debug' => true,
        'log' => [
            'level' => 'debug',
            'file' => './tests/logs/ai.log',//日志相对路径
            'template' => "<<<<<<<<\n{response}\n--------\n{error}",//日志模版
        ],
        'baidu' => [
            'app_id' => '***',
            'app_key' => '***',
            'secret_key' => '***',
        ],
        'youtu' => [
             'app_id' => '***',
             'secret_id' => '***',
             'secret_key' => '***',
             'user_id' => ****
        ]
        'face_plus' => [
             'api_key' => '***',
             'api_secret' => '***',
        ],
    ];
    
  4. 在命令行下进入根目录,执行命令,比如测试腾讯优图人脸识别: vendor/phpunit/phpunit/phpunit --testdox tests/Youtu/Face/FaceTest.php

Installation

composer require hahaxixi/ai

Usage

1.一般使用

$config = [
    'log' => [...],//如,laravel:'file' => storage_path('logs/ai.log'),
    'baidu' => [...],
    'youtu' => [...],
    'face_plus' => [...],
];

//百度
$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();

2.Laravel使用

  • 项目目录config下面添加配置文件ai.php,配置内容和上文SimpleTest一致
  • 一行代码调用人脸检测示例
$result = Entry::Baidu(config('ai'))->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();

3.Yii2使用

  • 在配置文件params-local.php添加
    'ai'=>[
        'log' => [...],
        'face_plus' => [...],
        'baidu' => [...],
        'youtu' => [...],
    ],
  • 一行代码调用人脸检测示例
$result = Entry::Baidu(Yii::$app->params['ai')->face->select('detect')->where(['image' => file_get_contents(__DIR__ . '/file/face_detect.jpeg'), 'id_card_side' => 'front'])->get();

License

Apache License Version 2.0 see Apache License

空文件

简介

像laravel,yii2查询数据库一样优雅调用百度,face++,腾讯优图人工智能API 展开 收起
PHP
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
PHP
1
https://gitee.com/hahaxixi/AI.git
git@gitee.com:hahaxixi/AI.git
hahaxixi
AI
AI
master

搜索帮助

14c37bed 8189591 565d56ea 8189591