2017 © Pedro Peláez
 

library tencent-ai

Tencent AI SDK

image

khs1994/tencent-ai

Tencent AI SDK

  • PHP
  • 2 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 44 % Grown

The README.md

Tencent AI SDK

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

微信订阅号

, (*2)

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

Installation

To Use Tencent AI SDK, simply:, (*4)

$ composer require khs1994/tencent-ai

For latest commit version:, (*5)

$ composer require khs1994/tencent-ai dev-master

Usage

<?php

require __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 exception

try {
    $result = $ai->face()->detect($image);
} catch (TencentAIException $e) {
    $result = $e->getExceptionAsArray();
}

// default return array

var_dump($result);

Laravel

$ php artisan vendor:publish --tag=config

Then edit config in config/tencent-ai.php, (*6)

<?php

use 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 array

var_dump($result);

// use DI

class 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);
    }
}

Tests

export TENCENT_AI_APP_ID
export TENCENT_AI_APP_KEY

Who use it?

PHP CaaS

Powered By khs1994-docker/lnmp, (*7)

The Versions

15/06 2018

dev-master

9999999-dev https://github.com/khs1994-php/tencent-ai

Tencent AI SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

sdk ai tencent tencent-ai

29/05 2018

18.05.0

18.05.0.0 https://github.com/khs1994-php/tencent-ai

Tencent AI SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

sdk ai tencent

24/04 2018

dev-analysis-XZ5ZQN

dev-analysis-XZ5ZQN https://github.com/khs1994-php/tencent-ai

Tencent AI SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

sdk ai tencent

28/03 2018

dev-analysis-zeBAWe

dev-analysis-zeBAWe https://github.com/khs1994-php/tencent-ai

Tencent AI SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

sdk ai tencent

08/03 2018

18.03.0

18.03.0.0 https://github.com/khs1994-php/tencent-ai

Tencent AI SDK

  Sources   Download

MIT

The Requires

 

The Development Requires

sdk ai tencent