Created
March 22, 2023 19:13
-
-
Save junwin/de3ddc5e0cfcdd3190e619a88e3db7cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = 'G:\My Drive\credential\your_credentials.json' | |
work_dir = 'C:/temp/2023Mar/Output/web' | |
from google.cloud import vision | |
def anotate_image(file_name): | |
client = vision.ImageAnnotatorClient() | |
with io.open(file_name, 'rb') as image_file: | |
content = image_file.read() | |
image = vision.Image(content=content) | |
# Perform label detection on the image file | |
response = client.label_detection(image=image) | |
labels = response.label_annotations | |
return labels | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment