Skip to content

Commit

Permalink
Fixed urlencode bug for models and added additional clarifai models.
Browse files Browse the repository at this point in the history
  • Loading branch information
PHPfanatic committed May 6, 2017
1 parent 1810902 commit 90b3874
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ or
Add the package manually by downloading the most recent stable version release from Github and include the src/ directory
within your own project.

* [zip](https://github.com/PHPfanatic/clarifai/archive/1.2.0.zip)
* [zip](https://github.com/PHPfanatic/clarifai/archive/1.2.1.zip)

* [tar](https://github.com/PHPfanatic/clarifai/archive/1.2.0.gz)
* [tar](https://github.com/PHPfanatic/clarifai/archive/1.2.1.gz)

### Requirements

Expand All @@ -47,6 +47,7 @@ $result = $client->Predict();
[PHPfanatic - ClarifAI documentation](https://github.com/PHPfanatic/clarifai/wiki/)

## Change History
* 1.2.1 - Fixed urlencode bug (credit: keithslater), added additional Clarifai models.
* 1.2.0 - Added model delete support, updated inputs to allow delete all.
* 1.1.0 - Added multi language support.
* 1.0.0 - Public API release.
Expand Down
2 changes: 1 addition & 1 deletion src/Api/AbstractBaseApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*
* @author Nick White <[email protected]>
* @link https://github.com/PHPfanatic/clarifai
* @version 1.2.0
* @version 1.2.1
*/

abstract class AbstractBaseApi implements AuthInterface
Expand Down
2 changes: 1 addition & 1 deletion src/Api/AuthInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Nick White <[email protected]>
* @link https://github.com/PHPfanatic/clarifai
* @version 1.2.0
* @version 1.2.1
*/

interface AuthInterface {
Expand Down
14 changes: 9 additions & 5 deletions src/ImageClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Nick White <[email protected]>
* @link https://github.com/PHPfanatic/clarifai
* @version 1.2.0
* @version 1.2.1
*/

use PhpFanatic\clarifAI\Api\AbstractBaseApi;
Expand All @@ -28,7 +28,11 @@ class ImageClient extends AbstractBaseApi
'Color'=>'eeed0b6733a644cea07cf4c60f87ebb7',
'Apparel'=>'e0be3b9d6a454f0493ac3a30784001ff',
'Celebrity'=>'e466caa0619f444ab97497640cefc4dc',
'Face'=>'a403429f2ddf4b49b307e318f00e528b'
'Face'=>'a403429f2ddf4b49b307e318f00e528b',
'Demographics'=>'c0c0ac362b03416da06ab3fa36fb58e3',
'Focus'=>'c2cf7cecd8a6427da375b9f35fcd2381',
'Logo'=>'c443119bf2ed4da98487520d01a0b1e3',
'Embedding'=>'bbb5f41425b8468d9b7a554ff10f8581'
];

private $languages = [
Expand Down Expand Up @@ -131,7 +135,7 @@ public function ModelDelete($id=null, $version=null) {
$service="models";

if($id != null) {
$service .= '/' . $id;
$service .= '/' . urlencode($id);
}

if($id != null && $version != null) {
Expand Down Expand Up @@ -194,7 +198,7 @@ public function ModelTrain($id) {
}
}

$service = 'models/'.$id.'/versions';
$service = 'models/'.urlencode($id).'/versions';
$result = $this->SendPost(null, $service);

return (Response::GetJson($result));
Expand Down Expand Up @@ -222,7 +226,7 @@ public function Predict($model='General') {

// Custom model handler.
if(!array_key_exists($model, $this->models)) {
$service = 'models/' . $model . '/outputs';
$service = 'models/' . urlencode($model) . '/outputs';
}
else {
$service = 'models/' . $this->models[$model] . '/outputs';
Expand Down
2 changes: 1 addition & 1 deletion src/Response/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*
* @author Nick White <[email protected]>
* @link https://github.com/PHPfanatic/clarifai
* @version 1.2.0
* @version 1.2.1
*/

class Response
Expand Down

0 comments on commit 90b3874

Please sign in to comment.