mirror of
https://github.com/Xevion/phototag.git
synced 2025-12-15 02:12:33 -06:00
initialization
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
key/
|
||||
BIN
DSC_6315.jpg
Normal file
BIN
DSC_6315.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.5 MiB |
23
main.py
Normal file
23
main.py
Normal 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])
|
||||
Reference in New Issue
Block a user