Skip to content

Commit 0b63256

Browse files
sirtorrybshaffer
authored andcommitted
Vision Product Search samples (GoogleCloudPlatform#765)
1 parent 738d54a commit 0b63256

34 files changed

+1936
-5
lines changed

testing/run_test_suite.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ ALT_PROJECT_TESTS=(
5151
pubsub/api
5252
storage
5353
video
54+
vision
5455
)
5556

5657
GRPC_INI=$(php -i | grep grpc.ini | sed 's/,*$//g')

vision/README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Vision API from PHP.
2626
Run `php composer.phar install` (if composer is installed locally) or `composer install`
2727
(if composer is installed globally).
2828
5. For a basic demonstration of the Cloud Vision API, run `php quickstart.php`.
29-
6. Run `php vision.php`. The following commands are available:
29+
6. Run `php vision.php` or `php product_search.php`. For `vision.php`, the following commands are available:
3030
```
3131
face Detect faces in an image using Google Cloud Vision API
3232
help Displays help for a command
@@ -45,7 +45,30 @@ Vision API from PHP.
4545
web-geo Detect web entities in an image with geo metadata using
4646
Google Cloud Vision API
4747
```
48-
7. Run `php vision.php COMMAND --help` to print information about the usage of each command.
48+
For `product_search.php`, the following commands are available:
49+
```
50+
product-create Create a product
51+
product-delete Delete a product
52+
product-get Get information of a product
53+
product-list List information for all products
54+
product-update Update information for a product
55+
product-image-create Create reference image
56+
product-image-delete Delete reference image
57+
product-image-get Get reference image information for a product
58+
product-image-list List all reference image information for a product
59+
product-search-similar Search for similar products to local image
60+
product-search-similar-gcs Search for similar products to GCS image
61+
product-set-create Create a product set
62+
product-set-delete Delete a product set
63+
product-set-get Get information for a product set
64+
product-set-import Import a product set
65+
product-set-list List information for all product sets
66+
product-set-add-product Add product to a product set
67+
product-set-list-products List products in a product set
68+
product-set-remove-product Remove product from a product set
69+
```
70+
71+
7. Run `php vision.php COMMAND --help` or `php product_search.php COMMAND --help` to print information about the usage of each command.
4972

5073
## The client library
5174

vision/composer.json

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "google/vision",
33
"type": "project",
44
"require": {
5-
"google/cloud-vision": "^0.17",
5+
"google/cloud-vision": "^0.19",
66
"google/cloud-storage": "^1.3",
77
"symfony/console": "^3.1"
88
},
@@ -35,10 +35,35 @@
3535
"src/detect_object_gcs.php",
3636
"src/detect_web_with_geo_metadata.php",
3737
"src/detect_web_with_geo_metadata_gcs.php",
38-
"src/detect_pdf_gcs.php"
38+
"src/detect_pdf_gcs.php",
39+
"src/product_create.php",
40+
"src/product_delete.php",
41+
"src/product_get.php",
42+
"src/product_image_create.php",
43+
"src/product_image_delete.php",
44+
"src/product_image_get.php",
45+
"src/product_image_list.php",
46+
"src/product_list.php",
47+
"src/product_search_similar.php",
48+
"src/product_search_similar_gcs.php",
49+
"src/product_set_add_product.php",
50+
"src/product_set_create.php",
51+
"src/product_set_delete.php",
52+
"src/product_set_get.php",
53+
"src/product_set_import.php",
54+
"src/product_set_list.php",
55+
"src/product_set_list_products.php",
56+
"src/product_set_remove_product.php",
57+
"src/product_update.php"
3958
]
4059
},
4160
"require-dev": {
42-
"phpunit/phpunit": "~4"
61+
"phpunit/phpunit": "~4",
62+
"google/cloud-tools": "^0.8.5"
63+
},
64+
"autoload-dev": {
65+
"files": [
66+
"test/ProductSearchTestTrait.php"
67+
]
4368
}
4469
}

vision/images/cat.jpg

-72.8 KB
Binary file not shown.

vision/images/eiffel_tower.jpg

-162 KB
Binary file not shown.

vision/images/face.png

-458 KB
Binary file not shown.

vision/images/landmark.jpg

-158 KB
Binary file not shown.

vision/images/text.jpg

-122 KB
Binary file not shown.

0 commit comments

Comments
 (0)