
"""simple docstring"""






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 			_SCREAMING_SNAKE_CASE					(			unittest.TestCase							):
			UpperCAmelCase_  :Tuple				 =						MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING






			def  __lowerCAmelCase (					self       ,   __A       ,   __A       ,   __A       )			->     List[Any]:
						lowerCAmelCase_    :Dict			     =  hf_hub_download(
						    repo_id="""nateraw/video-demo"""       ,   filename="""archery.mp4"""       ,   repo_type="""dataset"""       )
						lowerCAmelCase_    :int			     =  VideoClassificationPipeline(model=SCREAMING_SNAKE_CASE_       ,   image_processor=SCREAMING_SNAKE_CASE_       ,   top_k=2       )
						lowerCAmelCase_    :Union[str, Any]			     =  [
						    example_video_filepath,
						    'https://huggingface.co/datasets/nateraw/video-demo/resolve/main/archery.mp4',
						]
						return video_classifier, examples






			def  __lowerCAmelCase (					self       ,   __A       ,   __A       )			->     Dict:
						for example in examples:
									lowerCAmelCase_    :Tuple			     =  video_classifier(SCREAMING_SNAKE_CASE_       )

									self.assertEqual(
									    SCREAMING_SNAKE_CASE_       ,   [
									        {"""score""": ANY(SCREAMING_SNAKE_CASE_       ), """label""": ANY(SCREAMING_SNAKE_CASE_       )},
									        {"""score""": ANY(SCREAMING_SNAKE_CASE_       ), """label""": ANY(SCREAMING_SNAKE_CASE_       )},
									    ]       ,   )






			@require_torch
			def  __lowerCAmelCase (					self       )			->     Optional[int]:
						lowerCAmelCase_    :Optional[Any]			     =  'hf-internal-testing/tiny-random-VideoMAEForVideoClassification'
						lowerCAmelCase_    :Optional[int]			     =  VideoMAEFeatureExtractor(
						    size={"""shortest_edge""": 10}       ,   crop_size={"""height""": 10, """width""": 10}       )
						lowerCAmelCase_    :str			     =  pipeline(
						    """video-classification"""       ,   model=SCREAMING_SNAKE_CASE_       ,   feature_extractor=SCREAMING_SNAKE_CASE_       ,   frame_sampling_rate=4       )

						lowerCAmelCase_    :Tuple			     =  hf_hub_download(repo_id="""nateraw/video-demo"""       ,   filename="""archery.mp4"""       ,   repo_type="""dataset"""       )
						lowerCAmelCase_    :int			     =  video_classifier(SCREAMING_SNAKE_CASE_       ,   top_k=2       )
						self.assertEqual(
						    nested_simplify(SCREAMING_SNAKE_CASE_       ,   decimals=4       )       ,   [{"""score""": 0.5_1_9_9, """label""": """LABEL_0"""}, {"""score""": 0.4_8_0_1, """label""": """LABEL_1"""}]       ,   )

						lowerCAmelCase_    :Dict			     =  video_classifier(
						    [
						        video_file_path,
						        video_file_path,
						    ]       ,   top_k=2       ,   )
						self.assertEqual(
						    nested_simplify(SCREAMING_SNAKE_CASE_       ,   decimals=4       )       ,   [
						        [{"""score""": 0.5_1_9_9, """label""": """LABEL_0"""}, {"""score""": 0.4_8_0_1, """label""": """LABEL_1"""}],
						        [{"""score""": 0.5_1_9_9, """label""": """LABEL_0"""}, {"""score""": 0.4_8_0_1, """label""": """LABEL_1"""}],
						    ]       ,   )






			@require_tf
			def  __lowerCAmelCase (					self       )			->     int:
						pass










'''simple docstring'''



from math import isqrt



def 			UpperCAmelCase__					(	UpperCAmelCase_    :				int							)     ->		bool:
     return all(number % divisor != 0 for divisor in range(2      ,    isqrt(UpperCAmelCase_							) + 1							)							)



def 			UpperCAmelCase__					(	UpperCAmelCase_    :				int = 10**6							)     ->		int:
     __lowerCamelCase   :	Optional[Any]								=		0
     __lowerCamelCase   :	Optional[int]								=		1
     __lowerCamelCase   :	List[str]								=		7
     while prime_candidate < max_prime:
          primes_count += is_prime(UpperCAmelCase_							)

          cube_index += 1
          prime_candidate += 6 * cube_index

     return primes_count


if __name__ == "__main__":
      print(f'''{solution() = }''')






