"""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				(		lowerCAmelCase_   ):
    _snake_case     :  Dict     							=							'openai/whisper-base'
    _snake_case     :  Dict     							=							(
        'This is a tool that transcribes an audio into text. It takes an input named `audio` and returns the '
        'transcribed text.'
    )
    _snake_case     :  Optional[Any]     							=							'transcriber'
    _snake_case     :  List[str]     							=							WhisperProcessor
    _snake_case     :  int     							=							WhisperForConditionalGeneration

    _snake_case     :  Dict     							=							['audio']
    _snake_case     :  Any     							=							['text']


    def      lowerCAmelCase_  (					self	:  Tuple   ,				__lowerCAmelCase	:  Optional[Any]					):
      return self.pre_processor(__lowerCAmelCase   ,				return_tensors="""pt"""					).input_features


    def      lowerCAmelCase_  (					self	:  int   ,				__lowerCAmelCase	:  Tuple					):
      return self.model.generate(inputs=__lowerCAmelCase					)


    def      lowerCAmelCase_  (					self	:  Optional[Any]   ,				__lowerCAmelCase	:  List[str]					):
      return self.pre_processor.batch_decode(__lowerCAmelCase   ,				skip_special_tokens=__lowerCAmelCase					)[0]

"""simple docstring"""


from __future__ import annotations

from random import choice






def     __UpperCAmelCase					(			lowercase		):







  """simple docstring"""
  return choice(lowercase		)






def     __UpperCAmelCase					(			lowercase   ,lowercase		):







  """simple docstring"""
  _UpperCAmelCase						 =      random_pivot(lowercase		)

  # partition based on pivot
  # linear time
  _UpperCAmelCase						 =      [e for e in lst if e < pivot]
  _UpperCAmelCase						 =      [e for e in lst if e > pivot]

  # if we get lucky, pivot might be the element we want.
  # we can easily see this:
  # small (elements smaller than k)
  # + pivot (kth element)
  # + big (elements larger than k)
  if len(lowercase		) == k - 1:
    return pivot
  # pivot is in elements bigger than k
  elif len(lowercase		) < k - 1:
    return kth_number(lowercase   ,k - len(lowercase		) - 1		)
  # pivot is in elements smaller than k
  else:
    return kth_number(lowercase   ,lowercase		)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
