






"""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 							_SCREAMING_SNAKE_CASE    (	unittest.TestCase							,			__snake_case				):





							"""simple docstring"""





							def 			lowercase		( self:  Dict     ):

												'''simple docstring'''

												a__ 							=	load_tool('''image-segmentation'''     )
												self.tool.setup()
												a__ 							=	load_tool('''image-segmentation'''					,		remote=__A     )




							def 			lowercase		( self:  int     ):

												'''simple docstring'''

												a__ 							=	Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''     )     ) / '''000000039769.png'''     )
												a__ 							=	self.tool(__A					,		'''cat'''     )
												self.assertTrue(isinstance(__A					,		Image.Image     )     )




							def 			lowercase		( self:  List[str]     ):

												'''simple docstring'''

												a__ 							=	Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''     )     ) / '''000000039769.png'''     )
												a__ 							=	self.remote_tool(__A					,		'''cat'''     )
												self.assertTrue(isinstance(__A					,		Image.Image     )     )




							def 			lowercase		( self:  Any     ):

												'''simple docstring'''

												a__ 							=	Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''     )     ) / '''000000039769.png'''     )
												a__ 							=	self.tool(image=__A					,		label='''cat'''     )
												self.assertTrue(isinstance(__A					,		Image.Image     )     )





							def 			lowercase		( self:  List[str]     ):

												'''simple docstring'''

												a__ 							=	Image.open(Path(get_tests_dir('''fixtures/tests_samples/COCO'''     )     ) / '''000000039769.png'''     )
												a__ 							=	self.remote_tool(image=__A					,		label='''cat'''     )
												self.assertTrue(isinstance(__A					,		Image.Image     )     )










"""simple docstring"""







from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__a							:						int   							=			{
    'configuration_markuplm': ['MARKUPLM_PRETRAINED_CONFIG_ARCHIVE_MAP', 'MarkupLMConfig'],
    'feature_extraction_markuplm': ['MarkupLMFeatureExtractor'],
    'processing_markuplm': ['MarkupLMProcessor'],
    'tokenization_markuplm': ['MarkupLMTokenizer'],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__a							:						List[Any]   							=			['MarkupLMTokenizerFast']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	__a							:						List[Any]   							=			[
	    'MARKUPLM_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'MarkupLMForQuestionAnswering',
	    'MarkupLMForSequenceClassification',
	    'MarkupLMForTokenClassification',
	    'MarkupLMModel',
	    'MarkupLMPreTrainedModel',
	]


if TYPE_CHECKING:
	from .configuration_markuplm import MARKUPLM_PRETRAINED_CONFIG_ARCHIVE_MAP, MarkupLMConfig
	from .feature_extraction_markuplm import MarkupLMFeatureExtractor
	from .processing_markuplm import MarkupLMProcessor
	from .tokenization_markuplm import MarkupLMTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_markuplm_fast import MarkupLMTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_markuplm import (
		    MARKUPLM_PRETRAINED_MODEL_ARCHIVE_LIST,
		    MarkupLMForQuestionAnswering,
		    MarkupLMForSequenceClassification,
		    MarkupLMForTokenClassification,
		    MarkupLMModel,
		    MarkupLMPreTrainedModel,
		)


else:
	import sys

	__a							:						Tuple   							=			_LazyModule(__name__, globals()['__file__'], _import_structure)


