





'''simple docstring'''







from __future__ import annotations

from typing import Any


class 					__a      :

							def __init__(							self							:     List[Any]       ,     __magic_name__							:     int   )					->       None:







													"""simple docstring"""
													UpperCAmelCase_			:      List[Any]     						=  num_of_nodes
													UpperCAmelCase_			:      list[list[int]]     						=  []
													UpperCAmelCase_			:      dict[int, int]     						=  {}

							def     UpperCAmelCase__	(							self							:     Union[str, Any]       ,     __magic_name__							:     int       ,     __magic_name__							:     int       ,     __magic_name__							:     int   )					->       None:







													"""simple docstring"""
													self.m_edges.append([u_node, v_node, weight]   )

							def     UpperCAmelCase__	(							self							:     Tuple       ,     __magic_name__							:     int   )					->       int:







													"""simple docstring"""

													if self.m_component[u_node] == u_node:
																			return u_node
													return self.find_component(self.m_component[u_node]   )

							def     UpperCAmelCase__	(							self							:     List[str]       ,     __magic_name__							:     int   )					->       None:







													"""simple docstring"""

													if self.m_component[u_node] != u_node:
																			for k in self.m_component:
																									UpperCAmelCase_			:      int     						=  self.find_component(__magic_name__   )

							def     UpperCAmelCase__	(							self							:     Tuple       ,     __magic_name__							:     list[int]       ,     __magic_name__							:     int       ,     __magic_name__							:     int   )					->       None:







													"""simple docstring"""

													if component_size[u_node] <= component_size[v_node]:
																			UpperCAmelCase_			:      Dict     						=  v_node
																			component_size[v_node] += component_size[u_node]
																			self.set_component(__magic_name__   )

													elif component_size[u_node] >= component_size[v_node]:
																			UpperCAmelCase_			:      str     						=  self.find_component(__magic_name__   )
																			component_size[u_node] += component_size[v_node]
																			self.set_component(__magic_name__   )



							def     UpperCAmelCase__	(							self							:     Union[str, Any]   )					->       None:







													"""simple docstring"""
													UpperCAmelCase_			:      Union[str, Any]     						=  []
													UpperCAmelCase_			:      List[str]     						=  0

													UpperCAmelCase_			:      list[Any]     						=  [-1] * self.m_num_of_nodes

													# A list of components (initialized to all of the nodes)
													for node in range(self.m_num_of_nodes   ):
																			self.m_component.update({node: node}   )
																			component_size.append(1   )

													UpperCAmelCase_			:      Optional[int]     						=  self.m_num_of_nodes

													while num_of_components > 1:
																			for edge in self.m_edges:
																									UpperCAmelCase_			:      Tuple     						=  edge

																									UpperCAmelCase_			:      List[Any]     						=  self.m_component[u]
																									UpperCAmelCase_			:      List[Any]     						=  self.m_component[v]

																									if u_component != v_component:

																															for component in (u_component, v_component):
																																					if (
																																					    minimum_weight_edge[component] == -1
																																					    or minimum_weight_edge[component][2] > w
																																					):
																																											UpperCAmelCase_			:      Dict     						=  [u, v, w]

																			for edge in minimum_weight_edge:
																									if isinstance(__magic_name__       ,     __magic_name__   ):
																															UpperCAmelCase_			:      Dict     						=  edge

																															UpperCAmelCase_			:      int     						=  self.m_component[u]
																															UpperCAmelCase_			:      int     						=  self.m_component[v]

																															if u_component != v_component:
																																					mst_weight += w
																																					self.union(__magic_name__       ,     __magic_name__       ,     __magic_name__   )
																																					print(F"""Added edge [{u} - {v}]\nAdded weight: {w}\n"""   )
																																					num_of_components -= 1

																			UpperCAmelCase_			:      Optional[Any]     						=  [-1] * self.m_num_of_nodes
													print(F"""The total weight of the minimal spanning tree is: {mst_weight}"""   )





def        lowerCamelCase_      (  ) ->	None:

						'''simple docstring'''





						pass


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

							__a					:   int									=       ["audio"]
							__a					:   Optional[Any]									=       ["text"]

							def     UpperCAmelCase__	(							self							:     Dict       ,     __magic_name__							:     List[str]   )					->       Optional[int]:







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

							def     UpperCAmelCase__	(							self							:     Dict       ,     __magic_name__							:     Dict   )					->       Tuple:







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



							def     UpperCAmelCase__	(							self							:     List[str]       ,     __magic_name__							:     Dict   )					->       str:







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





