



# Copyright 2023 The HuggingFace Inc. team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor
from .base import PipelineTool
class 				__A					( A_      ):
			UpperCamelCase					:Tuple     =			'''openai/whisper-base'''
			UpperCamelCase					:Union[str, Any]     =			(
			    '''This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the '''
			    '''transcribed text.'''
			)
			UpperCamelCase					:Any     =			'''transcriber'''
			UpperCamelCase					:str     =			WhisperProcessor
			UpperCamelCase					:Tuple     =			WhisperForConditionalGeneration

			UpperCamelCase					:Union[str, Any]     =			['''audio''']
			UpperCamelCase					:Any     =			['''text''']





			def        _snake_case    (self							,    __magic_name__				):
						return self.pre_processor(__magic_name__							,    return_tensors="""pt"""				).input_features





			def        _snake_case    (self							,    __magic_name__				):
						return self.model.generate(inputs=__magic_name__				)





			def        _snake_case    (self							,    __magic_name__				):
						return self.pre_processor.batch_decode(__magic_name__							,    skip_special_tokens=__magic_name__				)[0]








def      _A				(UpperCamelCase		:      List[Any]      ,			UpperCamelCase		:      Dict )  ->List[str]:



			'''simple docstring'''







			lowerCamelCase__ :      int								=		[1]
			for i in range(2      ,			UpperCamelCase ):
						factorials.append(factorials[-1] * i )
			assert 0 <= k < factorials[-1] * n, "k out of bounds"

			lowerCamelCase__ :      Union[str, Any]								=		[]
			lowerCamelCase__ :      Optional[Any]								=		list(range(UpperCamelCase ) )

			# Find permutation
			while factorials:
						lowerCamelCase__ :      Union[str, Any]								=		factorials.pop()
						lowerCamelCase__							,lowerCamelCase__ :      Union[str, Any]								=		divmod(UpperCamelCase      ,			UpperCamelCase )
						permutation.append(elements[number] )
						elements.remove(elements[number] )
			permutation.append(elements[0] )

			return permutation


if __name__ == "__main__":
				import doctest

				doctest.testmod()



