ibm watson visual recognition php
1.0.0
該PHP庫提供與IBM Watson視覺識別服務的集成。
請參閱API文檔。
該庫的結構靈感來自包裝包裝套件。
這意味著圖書館並沒有隱藏正在提出API請求的事實。對於每個API請求,應使用傳遞,發送然後審查的參數創建請求。
所有請求均可通過客戶端獲得。
use BobbyshawWatsonVisualRecognitionClient;
use BobbyshawWatsonVisualRecognitionClassifier;
$client = new Client();
然後,應使用參數,例如用戶名和密碼(您的IBM Watson服務憑據)初始化客戶端。
$client->initialize(['username' => 'abcdef', 'password' => '12356])
可以使用以下查找默認參數
$client->getDefaultParameters();
每個方法都匹配API請求,並返回準備發送的請求對象。大多數時候,您需要立即發送請求。
$request = $client->getClassifiers();
$response = $request->send();
每個響應都有一個類,可以幫助管理響應,例如分類器和圖像類。
/** @var Classifier[] $classifiers */
$classifiers = $response->getClassifiers();
該庫還帶有一組命令,可在命令行上使用
php app/console classifiers:get [-d|--version-date="..."] username password
php app/console classifiers:classify [-c|--classifiers="..."] [-d|--version-date="..."] username password images
php app/console classifier:get [-d|--version-date="..."] username password classifier_id
php app/console classifier:create [-d|--version-date="..."] username password positive_examples negative_examples name
php app/console classifier:delete [-d|--version-date="..."] username password classifier_id
使用以下方式進行Phpunit測試:
vendor/bin/phpunit
這也是使用grumphp自動檢查PSR樣式格式的。
測試圖像由Pixabay提供。
phpdocumentor用於創建庫文檔。因此請確保添加功能評論
vendor/bin/
如果您還沒有,則可能需要在計算機上安裝GraphViz。這可以在Mac上與自製的Mac完成
brew install graphviz