
# 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   lowerCamelCase	(						A_						):
     UpperCAmelCase__       :							Union[str, Any]     =	"openai/whisper-base"
     UpperCAmelCase__       :							Any     =	(
         "This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the "
         "transcribed text."
     )
     UpperCAmelCase__       :							Tuple     =	"transcriber"
     UpperCAmelCase__       :							Dict     =	WhisperProcessor
     UpperCAmelCase__       :							Dict     =	WhisperForConditionalGeneration

     UpperCAmelCase__       :							Dict     =	["audio"]
     UpperCAmelCase__       :							str     =	["text"]





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





     def 	UpperCAmelCase(self   :					Tuple       ,					_A   :					List[str]     )		->		Any:
         return self.model.generate(inputs=_A     )





     def 	UpperCAmelCase(self   :					str       ,					_A   :					Union[str, Any]     )		->		Optional[int]:
         return self.pre_processor.batch_decode(_A       ,					skip_special_tokens=_A     )[0]








import os

# Precomputes a list of the 100 first triangular numbers
_A						      =				[int(0.5 * n * (n + 1)) for n in range(1, 1_01)]



def 		lowercase_    (     )							->							Tuple:
    """simple docstring"""

    snake_case				  =      os.path.dirname(os.path.realpath(A__	)	)
    snake_case				  =      os.path.join(A__				,	"words.txt"	)

    snake_case				  =      ""
    with open(A__	) as f:
        snake_case				  =      f.readline()

    snake_case				  =      [word.strip("\""	) for word in words.strip("\r\n"	).split(","	)]
    snake_case				  =      [
        word
        for word in [sum(ord(A__	) - 64 for x in word	) for word in words]
        if word in TRIANGULAR_NUMBERS
    ]
    return len(A__	)


if __name__ == "__main__":
   print(solution())

