restructure

This commit is contained in:
Xevion
2019-08-07 23:54:31 -05:00
parent 7759397d29
commit c9ba6add63
4 changed files with 87 additions and 22 deletions

26
package/app.py Normal file
View File

@@ -0,0 +1,26 @@
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()
def run():
# The name of the image file to annotate
path = os.path.join(sys.path[0], 'DSC_6315.jpg')
print(path)
# 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])