






"""simple docstring"""





from ..utils import DummyObject, requires_backends



class       __A		(   metaclass=SCREAMING_SNAKE_CASE_			):
					UpperCAmelCase__								=				["transformers", "torch", "note_seq"]

					def __init__(			self  :      Optional[Any]     ,		*__snake_case  :      Union[str, Any]     ,		**__snake_case  :      Optional[Any]					)			->							Optional[int]:
											requires_backends(self     ,		["""transformers""", """torch""", """note_seq"""]					)

					@classmethod
					def   lowerCamelCase__   (			cls  :      str     ,		*__snake_case  :      List[str]     ,		**__snake_case  :      Optional[int]					)			->							Tuple:
											requires_backends(cls     ,		["""transformers""", """torch""", """note_seq"""]					)






					@classmethod
					def   lowerCamelCase__   (			cls  :      int     ,		*__snake_case  :      Optional[int]     ,		**__snake_case  :      Union[str, Any]					)			->							List[str]:
											requires_backends(cls     ,		["""transformers""", """torch""", """note_seq"""]					)











"""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]



