Typical Use Flow
Under normal circumstances, users can make use of Galaxy Vision Service in a few simple steps.
- Click here to enter the Mi Eco Cloud homepage. Click at the avatar icon in the upper right corner for User Management. Create a user group on the left. Click at User Secret Key Tab at the bottom to generate a secret key to obtain authentication information
galaxy_access_key(ID under the user secret key) andgalaxy_key_secret("Key" under the user secret key) to gain access to the relevant service. Download SDK for the corresponding language and use it in your application. Take Python for example.
from cloud_vision.visionclient import Credential, VisionClient import os credential = Credential(galaxy_access_key="YOUR_AK", galaxy_key_secret="YOUR_SK") # access authentication info from Fusion cloud vision_client = VisionClient(credential=credential, endpoint="cnbj2.vision.api.xiaomi.com") # creat client using the access authentication info got from above with open("img_130.jpg","rb") as data: # Read binary information for a local image content = data.read() image = Image(content = content) detect_faces_request = DetectFacesRequest(image=image) faces_list = vision_client.analysis_faces(detect_faces_request) print faces_list detect_labels_request = DetectLabelsRequest(image=image) labels_list = vision_client.detect_labels(detect_labels_request) print labels_list.labels #parameter:image1 humanface1,image2 humanface2,face comparission pass threshold,default3500 face_compare_request = FaceCompareRequest(image1=image,image2=image,3500) match_face_result = vision_client.match_faces(face_compare_request) print match_face_result #parameter:fromLanguage:source language name code,toLanguage:target language name code,text: text to be translated nlp_translation_request = NlpTranslationRequest(fromLanguage="en",toLanguage="zh-chs",text="Hello World") nlp_translation_result = vision_client.nlp_translation(nlp_translation_request) print nlp_translation_result.result