






"""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 typing import TYPE_CHECKING

import torch

from ..models.auto import AutoModelForVisualQuestionAnswering, AutoProcessor
from ..utils import requires_backends
from .base import PipelineTool


if TYPE_CHECKING:
		from PIL import Image




class 						__UpperCamelCase     (     UpperCamelCase						):
					lowercase_    :				Optional[int]      =  """dandelin/vilt-b32-finetuned-vqa"""
					lowercase_    :				Optional[Any]      =  (
					    """This is a tool that answers a question about an image. It takes an input named `image` which should be the """
					    """image containing the information, as well as a `question` which should be the question in English. It """
					    """returns a text that is the answer to the question."""
					)
					lowercase_    :				Union[str, Any]      =  """image_qa"""
					lowercase_    :				Tuple      =  AutoProcessor
					lowercase_    :				List[Any]      =  AutoModelForVisualQuestionAnswering

					lowercase_    :				Optional[Any]      =  ["""image""", """text"""]
					lowercase_    :				List[Any]      =  ["""text"""]
					def __init__(							self							:	Tuple     , *UpperCAmelCase							:	Any     , **UpperCAmelCase							:	Union[str, Any]   )	->       Optional[int]:
											requires_backends(self     , ['vision']   )
											super().__init__(*UpperCAmelCase     , **UpperCAmelCase   )
					def        UpperCAmelCase__ (							self							:	Any     , UpperCAmelCase							:	"Image"     , UpperCAmelCase							:	str   )	->       Dict:
											return self.pre_processor(UpperCAmelCase     , UpperCAmelCase     , return_tensors='pt'   )
					def        UpperCAmelCase__ (							self							:	Any     , UpperCAmelCase							:	Tuple   )	->       str:
											with torch.no_grad():
																	return self.model(**UpperCAmelCase   ).logits
					def        UpperCAmelCase__ (							self							:	Dict     , UpperCAmelCase							:	List[Any]   )	->       int:
											lowerCAmelCase   :str						=			outputs.argmax(-1   ).item()
											return self.model.config.idalabel[idx]







"""simple docstring"""


import math


def        UpperCAmelCase      (					a__     ,      a__ ):





						'''simple docstring'''






						if 0 not in (x, y):
												# We use the relation x^y = y*log10(x), where 10 is the base.
												return y * math.logaa(a__ )
						else:
												if x == 0:  # 0 raised to any number is 0
																		return 0
												elif y == 0:
																		return 1  # any number raised to 0 is 1
						raise AssertionError('This should never happen' )


if __name__ == "__main__":  # Main function
		# Read two numbers from input and typecast them to int using map function.
		# Here x is the base and y is the power.
		__SCREAMING_SNAKE_CASE   =   'Enter the base and the power separated by a comma: '
		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE   =   map(int, input(prompt).split(','))
		__SCREAMING_SNAKE_CASE,						__SCREAMING_SNAKE_CASE   =   map(int, input(prompt).split(','))

		# We find the log of each number, using the function res(), which takes two
		# arguments.
		__SCREAMING_SNAKE_CASE   =   res(xa, ya)
		__SCREAMING_SNAKE_CASE   =   res(xa, ya)

		# We check for the largest number
		if resa > resa:
				print('Largest number is', xa, '^', ya)
		elif resa > resa:
				print('Largest number is', xa, '^', ya)
		else:
				print('Both are equal')