
from ..utils import DummyObject, requires_backends




class    _SCREAMING_SNAKE_CASE					( metaclass=snake_case__	):
     _A  :						Any      		=       ["torch", "librosa"]
     def __init__(     self						,		*lowerCamelCase						,		**lowerCamelCase	):
         requires_backends(self						,		["torch", "librosa"]	)
     @classmethod
     def A_     (     cls						,		*lowerCamelCase						,		**lowerCamelCase	):
         requires_backends(cls						,		["torch", "librosa"]	)



     @classmethod
     def A_     (     cls						,		*lowerCamelCase						,		**lowerCamelCase	):
         requires_backends(cls						,		["torch", "librosa"]	)





class    _SCREAMING_SNAKE_CASE					( metaclass=snake_case__	):
     _A  :						Union[str, Any]      		=       ["torch", "librosa"]
     def __init__(     self						,		*lowerCamelCase						,		**lowerCamelCase	):
         requires_backends(self						,		["torch", "librosa"]	)
     @classmethod
     def A_     (     cls						,		*lowerCamelCase						,		**lowerCamelCase	):
         requires_backends(cls						,		["torch", "librosa"]	)



     @classmethod
     def A_     (     cls						,		*lowerCamelCase						,		**lowerCamelCase	):
         requires_backends(cls						,		["torch", "librosa"]	)





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    _SCREAMING_SNAKE_CASE					( unittest.TestCase    ,   __UpperCamelCase	):
      def A_     (     self	):
          snake_case__  =			load_tool("image-captioning"	)
          self.tool.setup()
          snake_case__  =			load_tool("image-captioning"						,		remote=lowerCamelCase	)
      def A_     (     self	):
          snake_case__  =			Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
          snake_case__  =			self.tool(lowerCamelCase	)
          self.assertEqual(lowerCamelCase						,		"two cats sleeping on a couch"	)
      def A_     (     self	):
          snake_case__  =			Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
          snake_case__  =			self.remote_tool(lowerCamelCase	)
          self.assertEqual(lowerCamelCase						,		"two cats sleeping on a couch"	)
      def A_     (     self	):
          snake_case__  =			Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
          snake_case__  =			self.tool(image=lowerCamelCase	)
          self.assertEqual(lowerCamelCase						,		"two cats sleeping on a couch"	)



      def A_     (     self	):
          snake_case__  =			Image.open(Path(get_tests_dir("fixtures/tests_samples/COCO"	)	) / "000000039769.png"	)
          snake_case__  =			self.remote_tool(image=lowerCamelCase	)
          self.assertEqual(lowerCamelCase						,		"two cats sleeping on a couch"	)



