I want to get only "sorrow_likelihood" attribute from face_annotations in Google Vision API.
**Error**
Face detected
Traceback (most recent call last):
File "e:\Repo\Mytrapture\web_project\web_project\test.py", line 26, in <module>
print(response.face_annotations.sorrow_likelihood)
AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'sorrow_likelihood'
Code snippet-
client = vision.ImageAnnotatorClient()
response = client.annotate_image({
'image': {
'source': {
'image_uri': url
}
}
})
f = "face_annotations"
if f in str(response):
print("Face detected")
print(response.face_annotations.sorrow_likelihood)
else:
print("Face not detected")