Fix test_pipelines_video_classification that was always failing (#35842)
* Fix test_pipelines_video_classification that was always failing * Update video pipeline docstring to reflect actual return type --------- Co-authored-by: Louis Groux <louis.cal.groux@gmail.com>
This commit is contained in:
@@ -106,9 +106,9 @@ class VideoClassificationPipeline(Pipeline):
|
|||||||
post-processing.
|
post-processing.
|
||||||
|
|
||||||
Return:
|
Return:
|
||||||
A dictionary or a list of dictionaries containing result. If the input is a single video, will return a
|
A list of dictionaries or a list of list of dictionaries containing result. If the input is a single video,
|
||||||
dictionary, if the input is a list of several videos, will return a list of dictionaries corresponding to
|
will return a list of `top_k` dictionaries, if the input is a list of several videos, will return a list of list of
|
||||||
the videos.
|
`top_k` dictionaries corresponding to the videos.
|
||||||
|
|
||||||
The dictionaries contain the following keys:
|
The dictionaries contain the following keys:
|
||||||
|
|
||||||
|
|||||||
@@ -91,14 +91,13 @@ class VideoClassificationPipelineTests(unittest.TestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
video_file_path = hf_hub_download(repo_id="nateraw/video-demo", filename="archery.mp4", repo_type="dataset")
|
video_file_path = hf_hub_download(repo_id="nateraw/video-demo", filename="archery.mp4", repo_type="dataset")
|
||||||
outputs = video_classifier(video_file_path, top_k=2)
|
output = video_classifier(video_file_path, top_k=2)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
nested_simplify(outputs, decimals=4),
|
nested_simplify(output, decimals=4),
|
||||||
[{"score": 0.5199, "label": "LABEL_0"}, {"score": 0.4801, "label": "LABEL_1"}],
|
[{"score": 0.5199, "label": "LABEL_0"}, {"score": 0.4801, "label": "LABEL_1"}],
|
||||||
)
|
)
|
||||||
for output in outputs:
|
for element in output:
|
||||||
for element in output:
|
compare_pipeline_output_to_hub_spec(element, VideoClassificationOutputElement)
|
||||||
compare_pipeline_output_to_hub_spec(element, VideoClassificationOutputElement)
|
|
||||||
|
|
||||||
outputs = video_classifier(
|
outputs = video_classifier(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user