initialization

This commit is contained in:
Xevion
2019-08-03 18:49:27 -05:00
commit 01d6420ddc
3 changed files with 24 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
key/

BIN
DSC_6315.jpg Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 MiB

23
main.py Normal file
View File

@@ -0,0 +1,23 @@
import io, sys, os
# Imports the Google Cloud client library
from google.cloud import vision
from google.cloud.vision import types
# Instantiates a client
client = vision.ImageAnnotatorClient()
# The name of the image file to annotate
path = os.path.join(sys.path[0], 'DSC_6315.jpg')
# Loads the image into memory
with io.open(path, 'rb') as image_file:
content = image_file.read()
image = types.Image(content=content)
# Performs label detection on the image file
response = client.label_detection(image=image)
labels = response.label_annotations
print([label.description for label in labels])