# Imports the Google Cloud client library from google.cloud import vision from google.cloud.vision import types def is_cat(content): labels = fetch_data(content) if labels[0].description == "cat": return True else: return False def fetch_data(content): # Instantiates a client client = vision.ImageAnnotatorClient() # Tell Google Vision that our content is of type Image image = types.Image(content=content) # Performs label detection on the image file response = client.label_detection(image=image) # Return array of labels return response.label_annotations