



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  __snake_case      (   unittest.TestCase):







							'''simple docstring'''






							UpperCamelCase__				:      List[str]         =					MODEL_FOR_VIDEO_CLASSIFICATION_MAPPING


							def _a      (							self  ,  a_  ,  a_  ,  a_		):
											a__				      =		hf_hub_download(
											    repo_id="""nateraw/video-demo"""  ,  filename="""archery.mp4"""  ,  repo_type="""dataset"""		)
											a__				      =		VideoClassificationPipeline(model=a_  ,  image_processor=a_  ,  top_k=2		)
											a__				      =		[
											    example_video_filepath,
											    """https://huggingface.co/datasets/nateraw/video-demo/resolve/main/archery.mp4""",
											]
											return video_classifier, examples


							def _a      (							self  ,  a_  ,  a_		):
											for example in examples:
															a__				      =		video_classifier(a_		)

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


							@require_torch
							def _a      (							self		):
											a__				      =		"""hf-internal-testing/tiny-random-VideoMAEForVideoClassification"""
											a__				      =		VideoMAEFeatureExtractor(
											    size={"""shortest_edge""": 10}  ,  crop_size={"""height""": 10, """width""": 10}		)
											a__				      =		pipeline(
											    """video-classification"""  ,  model=a_  ,  feature_extractor=a_  ,  frame_sampling_rate=4		)

											a__				      =		hf_hub_download(repo_id="""nateraw/video-demo"""  ,  filename="""archery.mp4"""  ,  repo_type="""dataset"""		)
											a__				      =		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"""}]  ,  )

											a__				      =		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 _a      (							self		):
											pass






def 			A_      (	__a     :				int ,		__a     :				int		):

				"""simple docstring"""
				return abs(__a		) if a == 0 else greatest_common_divisor(b % a ,		__a		)

def 			A_      (	__a     :				int ,		__a     :				int		):

				"""simple docstring"""
				while y:  # --> when y=0 then loop will terminate and return x as final GCD.
								a__      ,			a__				      =		y, x % y
				return abs(__a		)

def 			A_      (	):

				"""simple docstring"""
				try:
								a__				      =		input("""Enter two integers separated by comma (,): """		).split(""","""		)
								a__				      =		int(nums[0]		)
								a__				      =		int(nums[1]		)
								print(
								    F'''greatest_common_divisor({num_a}, {num_a}) = '''
								    F'''{greatest_common_divisor(__a ,		__a		)}'''		)
								print(F'''By iterative gcd({num_a}, {num_a}) = {gcd_by_iterative(__a ,		__a		)}'''		)
				except (IndexError, UnboundLocalError, ValueError):
								print("""Wrong input"""		)


if __name__ == "__main__":
	main()

