


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  snake_case_     (unittest.TestCase   ):
				@require_torch
				def 				lowerCamelCase__(   self     :List[str]   )      ->					Optional[Any]:
											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(__snake_case    ,candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']   )
											self.assertEqual(
											    nested_simplify(__snake_case   )    ,[{'score': 0.5_01, 'label': 'Sound of a dog'}, {'score': 0.4_99, 'label': 'Sound of vaccum cleaner'}]    ,)
				@unittest.skip('No models are available in TF'   )
				def 				lowerCamelCase__(   self     :Union[str, Any]   )      ->					List[str]:
											pass
				@slow
				@require_torch
				def 				lowerCamelCase__(   self     :Any   )      ->					Optional[Any]:
											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(__snake_case    ,candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']   )

											self.assertEqual(
											    nested_simplify(__snake_case   )    ,[
											        {'score': 0.9_99, 'label': 'Sound of a dog'},
											        {'score': 0.0_01, 'label': 'Sound of vaccum cleaner'},
											    ]    ,)

											a__    =  audio_classifier([audio] * 5    ,candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']   )
											self.assertEqual(
											    nested_simplify(__snake_case   )    ,[
											        [
											            {'score': 0.9_99, 'label': 'Sound of a dog'},
											            {'score': 0.0_01, '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(__snake_case   )    ,[
											        [
											            {'score': 0.9_99, 'label': 'Sound of a dog'},
											            {'score': 0.0_01, 'label': 'Sound of vaccum cleaner'},
											        ],
											    ]
											    * 5    ,)



				@unittest.skip('No models are available in TF'   )
				def 				lowerCamelCase__(   self     :List[str]   )      ->					Optional[int]:
											pass








from __future__ import annotations






def 							__lowercase     (				__lowerCAmelCase							:       list[int]     ):  # This function is recursive
							a__    =  len(__lowerCAmelCase     )
							# If the array contains only one element, we return it (it's the stop condition of
							# recursion)
							if array_length <= 1:
														return array
														# Else
							a__    =  array[0]
							a__    =  False
							a__    =  1
							a__    =  []
							while not is_found and i < array_length:
														if array[i] < pivot:
																					a__    =  True
																					a__    =  [element for element in array[i:] if element >= array[i]]
																					a__    =  longest_subsequence(__lowerCAmelCase     )
																					if len(__lowerCAmelCase     ) > len(__lowerCAmelCase     ):
																												a__    =  temp_array
														else:
																					i += 1

							a__    =  [element for element in array[1:] if element >= pivot]
							a__    =  [pivot, *longest_subsequence(__lowerCAmelCase     )]
							if len(__lowerCAmelCase     ) > len(__lowerCAmelCase     ):
														return temp_array
							else:
														return longest_subseq


if __name__ == "__main__":
						import doctest

						doctest.testmod()




