


"""simple docstring"""


import unittest

from datasets import load_dataset

from transformers.pipelines import pipeline
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow
@is_pipeline_test
@require_torch
class   _UpperCamelCase  (   unittest.TestCase		):
							'''simple docstring'''







							@require_torch
							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			pipeline(
										    task="zero-shot-audio-classification"    ,   model="hf-internal-testing/tiny-clap-htsat-unfused"	)
										__lowerCAmelCase				    =			load_dataset("ashraq/esc50"	)
										__lowerCAmelCase				    =			dataset["train"]["audio"][-1]["array"]
										__lowerCAmelCase				    =			audio_classifier(__a    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]	)
										self.assertEqual(
										    nested_simplify(__a	)    ,   [{"score": 0.5_0_1, "label": "Sound of a dog"}, {"score": 0.4_9_9, "label": "Sound of vaccum cleaner"}]    ,   )

							@unittest.skip("No models are available in TF"	)
							def 			snake_case				(     self	):
										pass

							@slow
							@require_torch
							def 			snake_case				(     self	):
										__lowerCAmelCase				    =			pipeline(
										    task="zero-shot-audio-classification"    ,   model="laion/clap-htsat-unfused"    ,   )
										# This is an audio of a dog
										__lowerCAmelCase				    =			load_dataset("ashraq/esc50"	)
										__lowerCAmelCase				    =			dataset["train"]["audio"][-1]["array"]
										__lowerCAmelCase				    =			audio_classifier(__a    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]	)

										self.assertEqual(
										    nested_simplify(__a	)    ,   [
										        {"score": 0.9_9_9, "label": "Sound of a dog"},
										        {"score": 0.0_0_1, "label": "Sound of vaccum cleaner"},
										    ]    ,   )

										__lowerCAmelCase				    =			audio_classifier([audio] * 5    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]	)
										self.assertEqual(
										    nested_simplify(__a	)    ,   [
										        [
										            {"score": 0.9_9_9, "label": "Sound of a dog"},
										            {"score": 0.0_0_1, "label": "Sound of vaccum cleaner"},
										        ],
										    ]
										    * 5    ,   )
										__lowerCAmelCase				    =			audio_classifier(
										    [audio] * 5    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]    ,   batch_size=5	)
										self.assertEqual(
										    nested_simplify(__a	)    ,   [
										        [
										            {"score": 0.9_9_9, "label": "Sound of a dog"},
										            {"score": 0.0_0_1, "label": "Sound of vaccum cleaner"},
										        ],
										    ]
										    * 5    ,   )



							@unittest.skip("No models are available in TF"	)
							def 			snake_case				(     self	):
										pass








"""simple docstring"""


def _lowerCamelCase	(		_UpperCamelCase    , _UpperCamelCase      ):

			'''simple docstring'''




			if not isinstance(_UpperCamelCase    , _UpperCamelCase      ):
						raise ValueError("iterations must be defined as integers"      )
			if not isinstance(_UpperCamelCase    , _UpperCamelCase      ) or not number >= 1:
						raise ValueError(
						    "starting number must be\n                         and integer and be more than 0"      )
			if not iterations >= 1:
						raise ValueError("Iterations must be done more than 0 times to play FizzBuzz"      )

			__lowerCAmelCase				    =			""
			while number <= iterations:
						if number % 3 == 0:
									out += "Fizz"
						if number % 5 == 0:
									out += "Buzz"
						if 0 not in (number % 3, number % 5):
									out += str(_UpperCamelCase      )

						# print(out)
						number += 1
						out += " "
			return out


if __name__ == "__main__":
	import doctest

	doctest.testmod()




