



"""simple docstring"""







import unittest

from transformers import load_tool

from .test_tools_common import ToolTesterMixin







class 				UpperCamelCase__       (     unittest.TestCase, snake_case_  ):




      """simple docstring"""




      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple	):
        lowerCAmelCase_       :    str								=			load_tool('text-classification'	)
        self.tool.setup()
        lowerCAmelCase_       :    Dict								=			load_tool('text-classification'   ,      remote=_A	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				List[Any]	):
        lowerCAmelCase_       :    List[str]								=			self.tool('That\'s quite cool'   ,      ['positive', 'negative']	)
        self.assertEqual(_A   ,      'positive'	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Tuple	):
        lowerCAmelCase_       :    Union[str, Any]								=			self.remote_tool('That\'s quite cool'   ,      ['positive', 'negative']	)
        self.assertEqual(_A   ,      'positive'	)



      def 					SCREAMING_SNAKE_CASE__			(				self    :				Dict	):
        lowerCAmelCase_       :    Dict								=			self.tool(text='That\'s quite cool'   ,      labels=['positive', 'negative']	)
        self.assertEqual(_A   ,      'positive'	)





      def 					SCREAMING_SNAKE_CASE__			(				self    :				Union[str, Any]	):
        lowerCAmelCase_       :    Optional[int]								=			self.remote_tool(text='That\'s quite cool'   ,      labels=['positive', 'negative']	)
        self.assertEqual(_A   ,      'positive'	)










"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_sentencepiece_available,
    is_speech_available,
    is_torch_available,
)


lowercase__		:    Optional[int]				   =     {
    """configuration_trocr""": ["""TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP""", """TrOCRConfig"""],
    """processing_trocr""": ["""TrOCRProcessor"""],
}


try:
     if not is_torch_available():
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     pass
else:
     lowercase__		:    Dict				   =     [
         """TROCR_PRETRAINED_MODEL_ARCHIVE_LIST""",
         """TrOCRForCausalLM""",
         """TrOCRPreTrainedModel""",
     ]


if TYPE_CHECKING:
     from .configuration_trocr import TROCR_PRETRAINED_CONFIG_ARCHIVE_MAP, TrOCRConfig
     from .processing_trocr import TrOCRProcessor

     try:
          if not is_torch_available():
               raise OptionalDependencyNotAvailable()
     except OptionalDependencyNotAvailable:
          pass
     else:
          from .modeling_trocr import TROCR_PRETRAINED_MODEL_ARCHIVE_LIST, TrOCRForCausalLM, TrOCRPreTrainedModel

else:
     import sys

     lowercase__		:    int				   =     _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)





