forked from qinyuanpei/wechat-analyse
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfaceApi.py
More file actions
29 lines (24 loc) · 817 Bytes
/
faceApi.py
File metadata and controls
29 lines (24 loc) · 817 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/python
#-*- coding: utf-8 -*-
import json
import TencentYoutuyun
class FaceAPI:
def __init__(self):
appid = '10109383'
userId = '875974254'
secretId = 'AKIDd3D8rKrzCAsKXXKn8E5i6EAsLYVCuoiP'
secretKey = 'ZtwjGYbP1PYT9anmV3MRGrCKDuPffOr4'
endPoint = TencentYoutuyun.conf.API_YOUTU_END_POINT
self.youtu = TencentYoutuyun.YouTu(appid, secretId, secretKey, userId, endPoint)
def detectFace(self,image):
try:
retocr = self.youtu.DetectFace(image)
return len(retocr['face'])>0
except Exception as e:
return false
def extractTags(self,image):
try:
retocr = self.youtu.imagetag(image)
return retocr['tags']
except Exception as e:
return None