





import unittest

from huggingface_hub import hf_hub_download

from transformers import MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING, VideoMAEFeatureExtractor
from transformers.pipelines import VideoClassificationPipeline, pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_decord,
    require_tf,
    require_torch,
    require_torch_or_tf,
    require_vision,
)

from .test_pipelines_common import ANY

@is_pipeline_test
@require_torch_or_tf
@require_vision
@require_decord
class  __A(						unittest.TestCase ):
					__A	  =       MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING

					def 	_UpperCamelCase     (      self,       A,       A,       A      ):





												"""simple docstring"""

												_UpperCamelCase              =						hf_hub_download(
												    repo_id='''nateraw/video-demo''',       filename='''archery.mp4''',       repo_type='''dataset'''      )
												_UpperCamelCase              =						VideoClassificationPipeline(model=_A,       image_processor=_A,       top_k=2      )
												_UpperCamelCase              =						[
												    example_video_filepath,
												    '''https://huggingface.co/datasets/nateraw/video-demo/resolve/main/archery.mp4''',
												]
												return video_classifier, examples

					def 	_UpperCamelCase     (      self,       A,       A      ):





												"""simple docstring"""

												for example in examples:
																			_UpperCamelCase              =						video_classifier(_A      )

																			self.assertEqual(
																			    _A,       [
																			        {'''score''': ANY(_A      ), '''label''': ANY(_A      )},
																			        {'''score''': ANY(_A      ), '''label''': ANY(_A      )},
																			    ],       )

					@require_torch
					def 	_UpperCamelCase     (      self      ):





												"""simple docstring"""

												_UpperCamelCase              =						'''hf-internal-testing/tiny-random-VideoMAEForVideoClassification'''
												_UpperCamelCase              =						VideoMAEFeatureExtractor(
												    size={'''shortest_edge''': 10},       crop_size={'''height''': 10, '''width''': 10}      )
												_UpperCamelCase              =						pipeline(
												    '''video-classification''',       model=_A,       feature_extractor=_A,       frame_sampling_rate=4      )

												_UpperCamelCase              =						hf_hub_download(repo_id='''nateraw/video-demo''',       filename='''archery.mp4''',       repo_type='''dataset'''      )
												_UpperCamelCase              =						video_classifier(_A,       top_k=2      )
												self.assertEqual(
												    nested_simplify(_A,       decimals=4      ),       [{'''score''': 0.5_199, '''label''': '''LABEL_0'''}, {'''score''': 0.4_801, '''label''': '''LABEL_1'''}],       )

												_UpperCamelCase              =						video_classifier(
												    [
												        video_file_path,
												        video_file_path,
												    ],       top_k=2,       )
												self.assertEqual(
												    nested_simplify(_A,       decimals=4      ),       [
												        [{'''score''': 0.5_199, '''label''': '''LABEL_0'''}, {'''score''': 0.4_801, '''label''': '''LABEL_1'''}],
												        [{'''score''': 0.5_199, '''label''': '''LABEL_0'''}, {'''score''': 0.4_801, '''label''': '''LABEL_1'''}],
												    ],       )



					@require_tf
					def 	_UpperCamelCase     (      self      ):





												"""simple docstring"""

												pass













import warnings

from ...utils import logging
from .image_processing_clip import CLIPImageProcessor


lowercase    : str    	=  logging.get_logger(__name__)

class  __A(						__UpperCAmelCase ):

     def __init__(      self,       *A,       **A      ):





            """simple docstring"""

            warnings.warn(
                '''The class CLIPFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'''
                ''' use CLIPImageProcessor instead.''',       A,       )
            super().__init__(*A,       **A      )






