




"""simple docstring"""





from math import atan, cos, radians, sin, tan

from .haversine_distance import haversine_distance

A				=							6378137.0
A				=							6356752.314245
A				=							6_378_137

def        _UpperCamelCase     (      UpperCamelCase					,							UpperCamelCase					,							UpperCamelCase					,							UpperCamelCase				)      ->      float:


			"""simple docstring"""
			__UpperCAmelCase						:			Dict												=       (AXIS_A - AXIS_B) / AXIS_A
			# Parametric latitudes
			# https://en.wikipedia.org/wiki/Latitude#Parametric_(or_reduced)_latitude
			__UpperCAmelCase						:			Dict												=       atan((1 - flattening) * tan(radians(UpperCamelCase				)				)				)
			__UpperCAmelCase						:			Optional[int]												=       atan((1 - flattening) * tan(radians(UpperCamelCase				)				)				)

			# Compute central angle between two points
			# using haversine theta. sigma =  haversine_distance / equatorial radius
			__UpperCAmelCase						:			List[Any]												=       haversine_distance(UpperCamelCase					,							UpperCamelCase					,							UpperCamelCase					,							UpperCamelCase				) / EQUATORIAL_RADIUS

			# Intermediate P and Q values
			__UpperCAmelCase						:			str												=       (b_lata + b_lata) / 2
			__UpperCAmelCase						:			Tuple												=       (b_lata - b_lata) / 2

			# Intermediate X value
			# X = (sigma - sin(sigma)) * sin^2Pcos^2Q / cos^2(sigma/2)
			__UpperCAmelCase						:			Tuple												=       (sin(UpperCamelCase				) ** 2) * (cos(UpperCamelCase				) ** 2)
			__UpperCAmelCase						:			Optional[Any]												=       cos(sigma / 2				) ** 2
			__UpperCAmelCase						:			List[Any]												=       (sigma - sin(UpperCamelCase				)) * (x_numerator / x_demonimator)

			# Intermediate Y value
			# Y = (sigma + sin(sigma)) * cos^2Psin^2Q / sin^2(sigma/2)
			__UpperCAmelCase						:			Union[str, Any]												=       (cos(UpperCamelCase				) ** 2) * (sin(UpperCamelCase				) ** 2)
			__UpperCAmelCase						:			List[str]												=       sin(sigma / 2				) ** 2
			__UpperCAmelCase						:			Union[str, Any]												=       (sigma + sin(UpperCamelCase				)) * (y_numerator / y_denominator)

			return EQUATORIAL_RADIUS * (sigma - ((flattening / 2) * (x_value + y_value)))


if __name__ == "__main__":
					import doctest

					doctest.testmod()







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

   A__		:	List[str]           =  ['''audio''']
   A__		:	Optional[int]           =  ['''text''']



   def    __UpperCAmelCase    (       self    :	Tuple							,       __lowerCamelCase    :	List[Any]				):



     """simple docstring"""
     return self.pre_processor(__lowerCamelCase							,       return_tensors='''pt'''				).input_features



   def    __UpperCAmelCase    (       self    :	Optional[int]							,       __lowerCamelCase    :	List[str]				):



     """simple docstring"""
     return self.model.generate(inputs=__lowerCamelCase				)





   def    __UpperCAmelCase    (       self    :	List[str]							,       __lowerCamelCase    :	int				):



     """simple docstring"""
     return self.pre_processor.batch_decode(__lowerCamelCase							,       skip_special_tokens=__lowerCamelCase				)[0]





