Le snippet fourni est un exemple Python utilisant Google Cloud Vision API pour détecter entités web (« mystery parts ») dans une image :
from __future__ import print_function
from google.cloud.vision import ImageAnnotatorClient
import io, os
def get_mystery_part(path):
client = ImageAnnotatorClient()
with io.open(path, 'rb') as f:
content = f.read()
image = types.Image(content=content)
response = client.web_detection(image)
for label in response.web_detection.best_guess_labels:
print("Mystery: {}".format(label.label))
Ce n'est pas un code triche jeu ; c'est un script analyse d'image IA pour détecter objets/entités dans photos.