I am trying to use the Google Vision API to read the labels for a image.
I am executing this on a Google Compute Engine instance with access to all Cloud APIs. And I am using a service account for authentication
I keep getting the following error
This the code I am executing
import io
#from google.cloud import storage
#from google.cloud.vision_v1 import ImageAnnotatorClient
from google.oauth2 import service_account
# using old version of API
from google.cloud import vision
from google.cloud.vision import types
image_client = vision.ImageAnnotatorClient(credentials='credentials.json')
with io.open('/home/username/instagram-ml/userbucket/images/test_image.jpg','rb') as image_file:
content = image_file.read()
image = types.Image(content=content)
#
image_response = image_client.label_detection(image =image)
labels = image_response.label_annotations
Up until line
image_response = image_client.label_detection(image =image)
Everything works fine and I get no authentication issues. But when I execute the above line I suddenly get this error.
Pretty much following the instructions on this page
Not very sure what is going wrong
You provide the client with a string (filename?) as credentials, but as specified in the docs, the credential argument, if passed, should be an instance of Credentials or one of its subclasses.