commit 01d6420ddc8387820d0252ae638e48e7f7cb5b12 Author: Xevion Date: Sat Aug 3 18:49:27 2019 -0500 initialization diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e2c0e5a --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +key/ \ No newline at end of file diff --git a/DSC_6315.jpg b/DSC_6315.jpg new file mode 100644 index 0000000..2696947 Binary files /dev/null and b/DSC_6315.jpg differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..ee4a4b3 --- /dev/null +++ b/main.py @@ -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]) \ No newline at end of file