Skip to content

Commit

Permalink
[Fix] Update attribute extraction in Google Video API
Browse files Browse the repository at this point in the history
Modified the Google Video API code to handle potential exceptions better. Changed the code to use the 'get' method instead of direct indexing for 'confidence' in 'attribute_dict', preventing KeyErrors when 'confidence' is not in the dictionary.
  • Loading branch information
coscialp committed Dec 19, 2023
1 parent 0b6b1f9 commit 34fe3da
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion edenai_apis/apis/google/google_video_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def video__face_detection_async__get_job_result(
for attr in track["timestampedObjects"][0].get(
"attributes", []
):
attribute_dict[attr["name"]] = attr["confidence"]
attribute_dict[attr["name"]] = attr.get("confidence")
attributs = FaceAttributes(
headwear=attribute_dict.get("headwear"),
frontal_gaze=attribute_dict.get("looking_at_camera"),
Expand Down

0 comments on commit 34fe3da

Please sign in to comment.