1 | <?php |
||
7 | class Client |
||
8 | { |
||
9 | /** |
||
10 | * @var HttpClient |
||
11 | */ |
||
12 | protected $client; |
||
13 | |||
14 | /** |
||
15 | * The Clarifai client id. |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $clientId; |
||
19 | |||
20 | /** |
||
21 | * The Clarifai client secret. |
||
22 | * @var string |
||
23 | */ |
||
24 | protected $clientSecret; |
||
25 | |||
26 | /** |
||
27 | * The Clarifai access token. |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $accessToken; |
||
31 | |||
32 | /** |
||
33 | * The Clarifai API base URL. |
||
34 | * @var string |
||
35 | */ |
||
36 | protected $baseUrl = 'https://api.clarifai.com/v2'; |
||
37 | |||
38 | /** |
||
39 | * Instantiate a new clarifai client. |
||
40 | * |
||
41 | * @param HttpClient $client |
||
42 | * @param string $clientId |
||
43 | * @param string $clientSecret |
||
44 | */ |
||
45 | 5 | public function __construct($client, $clientId, $clientSecret) |
|
51 | |||
52 | 3 | public function withAccessToken($accessToken) |
|
58 | |||
59 | /** |
||
60 | * Predict the content of an image using the Clarifai API. |
||
61 | * |
||
62 | * @param array $urls |
||
63 | * @param string $modelId |
||
64 | * @return array |
||
65 | */ |
||
66 | 3 | public function predict(array $urls, $modelId = Models::GENERAL) |
|
85 | |||
86 | /** |
||
87 | * Retrieve a new access token. |
||
88 | * |
||
89 | * @return array |
||
90 | */ |
||
91 | 1 | public function accessToken() |
|
103 | } |
||
104 |