Created
October 25, 2020 02:10
-
-
Save esenthil2018/5ebea27b63e12575855cf6fd7f2d6d76 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
#Sample code to use the google API | |
from google.cloud import vision | |
from google.cloud.vision import types | |
import os | |
os.environ["GOOGLE_APPLICATION_CREDENTIALS"] = "keyFile.json" | |
def vision(url): | |
image = types.Image() | |
image.source.image_uri = url | |
#client = vision.ImageAnnotatorClient() | |
label_results = client.label_detection(image=image) | |
for label in label_results.label_annotations: | |
#print(f'{label.description} - {label.score}') | |
label1 = label.description | |
return label1 | |
break | |
from google.cloud import vision | |
from google.cloud.vision import types | |
rlabel = [] | |
client = vision.ImageAnnotatorClient() | |
image = types.Image() | |
for row in insta_df['Url']: | |
image.source.image_uri = row | |
label_results = client.label_detection(image=image) | |
for label in label_results.label_annotations: | |
label1 = label.description | |
rlabel.append(label1) | |
break | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment