

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 						snake_case__     (      self :       Any		)->    Any:





        '''simple docstring'''







        A__          =   pipeline(
            task='zero-shot-audio-classification',model='hf-internal-testing/tiny-clap-htsat-unfused'		)
        A__          =   load_dataset('ashraq/esc50'		)
        A__          =   dataset['''train''']['''audio'''][-1]['''array''']
        A__          =   audio_classifier(lowercase_,candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']		)
        self.assertEqual(
            nested_simplify(lowercase_		),[{'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 						snake_case__     (      self :       Tuple		)->    Union[str, Any]:





        '''simple docstring'''







        pass


    @slow
    @require_torch
    def 						snake_case__     (      self :       Tuple		)->    str:





        '''simple docstring'''







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

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

        A__          =   audio_classifier([audio] * 5,candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']		)
        self.assertEqual(
            nested_simplify(lowercase_		),[
                [
                    {'score': 0.999, 'label': 'Sound of a dog'},
                    {'score': 0.001, 'label': 'Sound of vaccum cleaner'},
                ],
            ]
            * 5,)
        A__          =   audio_classifier(
            [audio] * 5,candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner'],batch_size=5		)
        self.assertEqual(
            nested_simplify(lowercase_		),[
                [
                    {'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 						snake_case__     (      self :       Any		)->    int:





        '''simple docstring'''







        pass






"""simple docstring"""
def  lowerCamelCase_						(UpperCamelCase__		:		int     ,       UpperCamelCase__		:		int							):
    if a < 0 or b < 0:
        raise ValueError('''the value of both inputs must be positive'''							)
    _UpperCAmelCase							:  List[str]											=    str(bin(UpperCamelCase__							)							)[2:]  # remove the leading "0b"
    _UpperCAmelCase							:  str											=    str(bin(UpperCamelCase__							)							)[2:]
    _UpperCAmelCase							:  List[str]											=    max(len(UpperCamelCase__							)     ,       len(UpperCamelCase__							)							)
    return "0b" + "".join(
        str(int('''1''' in (char_a, char_b)							)							)
        for char_a, char_b in zip(a_binary.zfill(UpperCamelCase__							)     ,       b_binary.zfill(UpperCamelCase__							)							)							)


if __name__ == "__main__":
  import doctest

  doctest.testmod()


