Added error handling in Detections.from_azure_analyze_image method

This commit is contained in:
SkalskiP
2023-12-05 13:57:27 +01:00
parent a31f964947
commit cb5e9c0df0
+5
View File
@@ -525,6 +525,11 @@ class Detections:
>>> detections = sv.Detections.from_azure_analyze_image(response)
"""
if "error" in azure_result:
raise ValueError(
f'Azure API returned an error {azure_result["error"]["message"]}'
)
xyxy, confidences, class_ids = [], [], []
is_dynamic_mapping = class_map is None