






"""simple docstring"""





# 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		(   SCREAMING_SNAKE_CASE_			):
					UpperCAmelCase__								=				"openai/whisper-base"
					UpperCAmelCase__								=				(
					    "This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the "
					    "transcribed text."
					)
					UpperCAmelCase__								=				"transcriber"
					UpperCAmelCase__								=				WhisperProcessor
					UpperCAmelCase__								=				WhisperForConditionalGeneration

					UpperCAmelCase__								=				["audio"]
					UpperCAmelCase__								=				["text"]

					def   lowerCamelCase__   (			self  :      Dict     ,		__snake_case  :      List[str]					)			->							Dict:
											return self.pre_processor(__snake_case     ,		return_tensors="""pt"""					).input_features

					def   lowerCamelCase__   (			self  :      int     ,		__snake_case  :      Union[str, Any]					)			->							List[str]:
											return self.model.generate(inputs=__snake_case					)






					def   lowerCamelCase__   (			self  :      Union[str, Any]     ,		__snake_case  :      List[Any]					)			->							Any:
											return self.pre_processor.batch_decode(__snake_case     ,		skip_special_tokens=__snake_case					)[0]











from __future__ import annotations



def  a__ (__lowercase							:list					,  __lowercase							:int | None = None					,  __lowercase							:int | None = None   )		-> None:
				if start is None:
								_A	:				Optional[int]   =      0

				if end is None:
								_A	:				Union[str, Any]   =      len(__lowercase   ) - 1

				if start >= end:
								return

				_A	:				Union[str, Any]   =      (start + end) // 2

				slowsort(__lowercase					,  __lowercase					,  __lowercase   )
				slowsort(__lowercase					,  mid + 1					,  __lowercase   )

				if sequence[end] < sequence[mid]:
								_A  ,				_A	:				Optional[int]   =      sequence[mid], sequence[end]

				slowsort(__lowercase					,  __lowercase					,  end - 1   )


if __name__ == "__main__":
	from doctest import testmod

	testmod()



