
"""simple docstring"""
def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						Optional[int] ):
 return -num if num < 0 else num

def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						int ):
 if len(lowercase_ ) == 0:
  raise ValueError('abs_min() arg is an empty sequence' )
 lowerCAmelCase													=   x[0]
 for i in x:
  if abs_val(lowercase_ ) < abs_val(lowercase_ ):
   lowerCAmelCase													=   i
 return j

def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						str ):
 if len(lowercase_ ) == 0:
  raise ValueError('abs_max() arg is an empty sequence' )
 lowerCAmelCase													=   x[0]
 for i in x:
  if abs(lowercase_ ) > abs(lowercase_ ):
   lowerCAmelCase													=   i
 return j

def 		_SCREAMING_SNAKE_CASE (_UpperCAmelCase				:						Dict ):
 if len(lowercase_ ) == 0:
  raise ValueError('abs_max_sort() arg is an empty sequence' )
 return sorted(lowercase_     ,    key=lowercase_ )[-1]

def 		_SCREAMING_SNAKE_CASE ():
 assert abs_val(0 ) == 0
 assert abs_val(34 ) == 34
 assert abs_val(-1000_0000_0000 ) == 1000_0000_0000

 lowerCAmelCase													=   [-3, -1, 2, -11]
 assert abs_max(lowercase_ ) == -11
 assert abs_max_sort(lowercase_ ) == -11
 assert abs_min(lowercase_ ) == -1


if __name__ == "__main__":
       import doctest

       doctest.testmod()

       test_abs_val()
       print(abs_val(-34))  # --> 34












"""simple docstring"""
import unittest
from pathlib import Path

from transformers import is_vision_available, load_tool
from transformers.testing_utils import get_tests_dir

from .test_tools_common import ToolTesterMixin


if is_vision_available():
       from PIL import Image







class 			a       (      unittest.TestCase      ,   a__     ):



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   load_tool('image-question-answering'    )
  self.tool.setup()
  lowerCAmelCase													=   load_tool('image-question-answering'							,					remote=_snake_case    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.tool(_snake_case							,					'How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.remote_tool(_snake_case							,					'How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.tool(image=_snake_case							,					question='How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.remote_tool(image=_snake_case							,					question='How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )





