


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





							'''simple docstring'''

							@require_torch
							def 						lowerCAmelCase				( self							:					Tuple				)    ->Optional[int]:



														"""simple docstring"""



														snake_case_							=						pipeline(
														    task="""zero-shot-audio-classification"""						,				model="""hf-internal-testing/tiny-clap-htsat-unfused"""				)
														snake_case_							=						load_dataset("""ashraq/esc50"""				)
														snake_case_							=						dataset["""train"""]["""audio"""][-1]["""array"""]
														snake_case_							=						audio_classifier(lowerCAmelCase_						,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]				)
														self.assertEqual(
														    nested_simplify(lowerCAmelCase_				)						,				[{"""score""": 0.501, """label""": """Sound of a dog"""}, {"""score""": 0.499, """label""": """Sound of vaccum cleaner"""}]						,				)



							@unittest.skip("""No models are available in TF"""				)
							def 						lowerCAmelCase				( self							:					Union[str, Any]				)    ->Dict:



														"""simple docstring"""



														pass



							@slow
							@require_torch
							def 						lowerCAmelCase				( self							:					List[Any]				)    ->str:



														"""simple docstring"""



														snake_case_							=						pipeline(
														    task="""zero-shot-audio-classification"""						,				model="""laion/clap-htsat-unfused"""						,				)
														# This is an audio of a dog
														snake_case_							=						load_dataset("""ashraq/esc50"""				)
														snake_case_							=						dataset["""train"""]["""audio"""][-1]["""array"""]
														snake_case_							=						audio_classifier(lowerCAmelCase_						,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]				)

														self.assertEqual(
														    nested_simplify(lowerCAmelCase_				)						,				[
														        {"""score""": 0.999, """label""": """Sound of a dog"""},
														        {"""score""": 0.001, """label""": """Sound of vaccum cleaner"""},
														    ]						,				)

														snake_case_							=						audio_classifier([audio] * 5						,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]				)
														self.assertEqual(
														    nested_simplify(lowerCAmelCase_				)						,				[
														        [
														            {"""score""": 0.999, """label""": """Sound of a dog"""},
														            {"""score""": 0.001, """label""": """Sound of vaccum cleaner"""},
														        ],
														    ]
														    * 5						,				)
														snake_case_							=						audio_classifier(
														    [audio] * 5						,				candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]						,				batch_size=5				)
														self.assertEqual(
														    nested_simplify(lowerCAmelCase_				)						,				[
														        [
														            {"""score""": 0.999, """label""": """Sound of a dog"""},
														            {"""score""": 0.001, """label""": """Sound of vaccum cleaner"""},
														        ],
														    ]
														    * 5						,				)



							@unittest.skip("""No models are available in TF"""				)
							def 						lowerCAmelCase				( self							:					Optional[int]				)    ->int:



														"""simple docstring"""



														pass





'''simple docstring'''







def 				SCREAMING_SNAKE_CASE__	(   __A	)       ->	bool:
	return number & 1 == 0


if __name__ == "__main__":
					import doctest

					doctest.testmod()

