
"""simple docstring"""






from ..models.whisper import WhisperForConditionalGeneration, WhisperProcessor
from .base import PipelineTool




class 				lowercase__(				_UpperCAmelCase   ):
	'''simple docstring'''

	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    :List[str]		, lowerCamelCase_    :List[Any]					)							->			Dict:







			'''simple docstring'''




			return self.pre_processor(lowerCamelCase_		, return_tensors='''pt'''					).input_features





	def   __lowerCAmelCase (						self    :int		, lowerCamelCase_    :int					)							->			Tuple:







			'''simple docstring'''




			return self.model.generate(inputs=lowerCamelCase_					)







	def   __lowerCAmelCase (						self    :Tuple		, lowerCamelCase_    :List[Any]					)							->			Any:







			'''simple docstring'''




			return self.pre_processor.batch_decode(lowerCamelCase_		, skip_special_tokens=lowerCamelCase_					)[0]







"""simple docstring"""






import os
import sys

lowerCamelCase__ :       List[Any]						     =			os.path.join(os.path.dirname(__file__), "src")
sys.path.append(SRC_DIR)


from transformers import (
    AutoConfig,
    AutoModel,
    AutoModelForCausalLM,
    AutoModelForMaskedLM,
    AutoModelForQuestionAnswering,
    AutoModelForSequenceClassification,
    AutoTokenizer,
    add_start_docstrings,
)


lowerCamelCase__ :       str						     =			[
    "torch",
    "numpy",
    "tokenizers",
    "filelock",
    "requests",
    "tqdm",
    "regex",
    "sentencepiece",
    "sacremoses",
    "importlib_metadata",
    "huggingface_hub",
]





@add_start_docstrings(AutoConfig.__doc__     )
def __A						(   *a_ :							Any		,		**a_ :							Union[str, Any]     )->							Dict:




		'''simple docstring'''






		return AutoConfig.from_pretrained(*a_		,		**a_     )





@add_start_docstrings(AutoTokenizer.__doc__     )
def __A						(   *a_ :							str		,		**a_ :							Union[str, Any]     )->							Union[str, Any]:




		'''simple docstring'''






		return AutoTokenizer.from_pretrained(*a_		,		**a_     )





@add_start_docstrings(AutoModel.__doc__     )
def __A						(   *a_ :							List[str]		,		**a_ :							int     )->							Dict:




		'''simple docstring'''






		return AutoModel.from_pretrained(*a_		,		**a_     )





@add_start_docstrings(AutoModelForCausalLM.__doc__     )
def __A						(   *a_ :							Any		,		**a_ :							Tuple     )->							Dict:




		'''simple docstring'''






		return AutoModelForCausalLM.from_pretrained(*a_		,		**a_     )





@add_start_docstrings(AutoModelForMaskedLM.__doc__     )
def __A						(   *a_ :							Dict		,		**a_ :							Optional[Any]     )->							Optional[int]:




		'''simple docstring'''






		return AutoModelForMaskedLM.from_pretrained(*a_		,		**a_     )





@add_start_docstrings(AutoModelForSequenceClassification.__doc__     )
def __A						(   *a_ :							Optional[int]		,		**a_ :							str     )->							Optional[int]:




		'''simple docstring'''






		return AutoModelForSequenceClassification.from_pretrained(*a_		,		**a_     )





@add_start_docstrings(AutoModelForQuestionAnswering.__doc__     )
def __A						(   *a_ :							List[str]		,		**a_ :							int     )->							List[Any]:




		'''simple docstring'''






		return AutoModelForQuestionAnswering.from_pretrained(*a_		,		**a_     )





