Last active
December 2, 2021 08:02
-
-
Save Akshay090/26083c8b51827d3f45bee33a87defd43 to your computer and use it in GitHub Desktop.
face plus plus Api reference
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
import json | |
import time | |
API_KEY = "123ApiKey" | |
API_SECRET = "superSecreteKey" | |
detect = { | |
'api_key': (None, API_KEY), | |
'api_secret': (None, API_SECRET), | |
'image_file': ('img.jpg', open('img.jpg', 'rb')), | |
'return_attributes': (None, 'gender,age'), | |
} | |
detectResp = requests.post('https://api-us.faceplusplus.com/facepp/v3/detect', files=detect) | |
u = json.loads(detectResp.text) | |
print(u) | |
print("----------------------------------------------------") | |
elem = u["faces"] | |
y = elem[0] | |
FACE_TOKEN = y["face_token"] | |
print(FACE_TOKEN) | |
time.sleep(3) | |
# faceset = { | |
# 'api_key': (None, API_KEY), | |
# 'api_secret': (None, API_SECRET), | |
# 'outer_id': (None, 'Final-faceset'), | |
# 'tag': (None, 'person,male'), | |
# 'face_tokens': (None, FACE_TOKEN), | |
# } | |
# facesetResp = requests.post('https://api-us.faceplusplus.com/facepp/v3/faceset/create', files=faceset) | |
# u = json.loads(facesetResp.text) | |
# print(u) | |
# facesetAdd = { | |
# 'api_key': (None, API_KEY), | |
# 'api_secret': (None, API_SECRET), | |
# 'outer_id': (None, 'Final-faceset'), | |
# 'face_tokens': (None, FACE_TOKEN), | |
# } | |
# time.sleep(3) | |
# facesetAdd_Resp = requests.post('https://api-us.faceplusplus.com/facepp/v3/faceset/addface', files=facesetAdd) | |
# u = json.loads(facesetAdd_Resp.text) | |
# print(u) | |
time.sleep(5) | |
faceSearch = { | |
'api_key': (None, API_KEY), | |
'api_secret': (None, API_SECRET), | |
'outer_id': (None, 'Final-faceset'), | |
'face_token': (None, FACE_TOKEN), | |
} | |
time.sleep(3) | |
faceSearch_Resp = requests.post('https://api-us.faceplusplus.com/facepp/v3/search', files=faceSearch) | |
u = json.loads(faceSearch_Resp.text) | |
print(u) |
@wasimpk don't remember much about this, but as you can see it's part of their api response
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
how do I get the face_token at the very first time