diff --git a/src/huggingface_hub/inference/_client.py b/src/huggingface_hub/inference/_client.py index 56ca203779..791259e039 100644 --- a/src/huggingface_hub/inference/_client.py +++ b/src/huggingface_hub/inference/_client.py @@ -3196,10 +3196,7 @@ def zero_shot_classification( ) response = self._inner_post(request_parameters) output = _bytes_to_dict(response) - return [ - ZeroShotClassificationOutputElement.parse_obj_as_instance({"label": label, "score": score}) - for label, score in zip(output["labels"], output["scores"]) - ] + return ZeroShotClassificationOutputElement.parse_obj_as_list(output) def zero_shot_image_classification( self, diff --git a/src/huggingface_hub/inference/_generated/_async_client.py b/src/huggingface_hub/inference/_generated/_async_client.py index 080c3fd8e5..feab3a230e 100644 --- a/src/huggingface_hub/inference/_generated/_async_client.py +++ b/src/huggingface_hub/inference/_generated/_async_client.py @@ -3246,10 +3246,7 @@ async def zero_shot_classification( ) response = await self._inner_post(request_parameters) output = _bytes_to_dict(response) - return [ - ZeroShotClassificationOutputElement.parse_obj_as_instance({"label": label, "score": score}) - for label, score in zip(output["labels"], output["scores"]) - ] + return ZeroShotClassificationOutputElement.parse_obj_as_list(output) async def zero_shot_image_classification( self,