Skip to content

Commit 2a4e392

Browse files
SurferJeffAtGooglebshaffer
authored andcommitted
Add Vision API Samples. (GoogleCloudPlatform#235)
1 parent 6aa4021 commit 2a4e392

33 files changed

+1950
-0
lines changed

vision/api/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Google Vision PHP Sample Application
2+
3+
## Description
4+
5+
This simple command-line application demonstrates how to invoke Google
6+
Vision API from PHP.
7+
8+
## Build and Run
9+
1. **Enable APIs** - [Enable the Vision API](https://console.cloud.google.com/flows/enableapi?apiid=vision.googleapis.com)
10+
and create a new project or select an existing project.
11+
2. **Download The Credentials** - Click "Go to credentials" after enabling the APIs. Click "New Credentials"
12+
and select "Service Account Key". Create a new service account, use the JSON key type, and
13+
select "Create". Once downloaded, set the environment variable `GOOGLE_APPLICATION_CREDENTIALS`
14+
to the path of the JSON key that was downloaded.
15+
3. **Clone the repo** and cd into this directory
16+
```
17+
$ git clone https://github.com/GoogleCloudPlatform/php-docs-samples
18+
$ cd php-docs-samples/vision/api
19+
```
20+
4. **Install dependencies** via [Composer](http://getcomposer.org/doc/00-intro.md).
21+
Run `php composer.phar install` (if composer is installed locally) or `composer install`
22+
(if composer is installed globally).
23+
5. Run `php vision.php`. The following commands are available:
24+
```
25+
face Detect faces in an image using Google Cloud Vision API
26+
help Displays help for a command
27+
label Detect labels in an image using Google Cloud Vision API
28+
landmark Detect landmarks in an image using Google Cloud Vision API
29+
list Lists commands
30+
logo Detect logos in an image using Google Cloud Vision API
31+
property Detect image proerties in an image using Google Cloud Vision API
32+
safe-search Detect adult content in an image using Google Cloud Vision API
33+
text Detect text in an image using Google Cloud Vision API
34+
```
35+
6. Run `php vision.php COMMAND --help` to print information about the usage of each command.
36+
37+
## Contributing changes
38+
39+
* See [CONTRIBUTING.md](../../CONTRIBUTING.md)
40+
41+
## Licensing
42+
43+
* See [LICENSE](../../LICENSE)

vision/api/composer.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "google/translate-sample",
3+
"type": "project",
4+
"require": {
5+
"google/cloud": "^0.11.1",
6+
"symfony/console": "^3.1"
7+
},
8+
"autoload": {
9+
"psr-4": {
10+
"Google\\Cloud\\Samples\\Vision\\": "src/"
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)