import json from os.path import join, dirname from watson_developer_cloud import AlchemyVisionV1 alchemy_vision = AlchemyVisionV1(api_key='YOUR API KEY') # Face recognition with open(join(dirname(__file__), '../resources/face.jpg'), 'rb') as image_file: print( json.dumps(alchemy_vision.recognize_faces(image_file, knowledge_graph=True), indent=2)) face_url = 'https://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg' print( json.dumps(alchemy_vision.recognize_faces(image_url=face_url, knowledge_graph=True), indent=2)) # Image tagging with open(join(dirname(__file__), '../resources/test.jpg'), 'rb') as image_file: print( json.dumps(alchemy_vision.get_image_keywords(image_file, knowledge_graph=True, force_show_all=True), indent=2)) print( json.dumps(alchemy_vision.get_image_keywords(
import json from os.path import join, dirname from watson_developer_cloud import AlchemyVisionV1 alchemy_vision = AlchemyVisionV1( api_key='c851400276c1acbd020210847f8677e6d1577c26') # Face recognition with open(join(dirname(__file__), '../resources/face.jpg'), 'rb') as image_file: print( json.dumps(alchemy_vision.recognize_faces(image_file, knowledge_graph=True), indent=2)) face_url = 'https://upload.wikimedia.org/wikipedia/commons/9/9d/Barack_Obama.jpg' print( json.dumps(alchemy_vision.recognize_faces(image_url=face_url, knowledge_graph=True), indent=2)) # Image tagging with open(join(dirname(__file__), '../resources/test.jpg'), 'rb') as image_file: print( json.dumps(alchemy_vision.get_image_keywords(image_file, knowledge_graph=True, force_show_all=True), indent=2)) # Text recognition with open(join(dirname(__file__), '../resources/text.png'),