




from ...processing_utils import ProcessorMixin
from ...tokenization_utils_base import BatchEncoding







class     __lowerCAmelCase (       __magic_name__ ):

			"""simple docstring"""







			snake_case_   		=       ['''image_processor''', '''tokenizer''']
			snake_case_   		=       '''AutoImageProcessor'''
			snake_case_   		=       '''AutoTokenizer'''


			def __init__(      self			,						lowerCamelCase__			,						lowerCamelCase__							)    ->      List[Any]:



							'''simple docstring'''
							super().__init__(lowerCamelCase__			,						lowerCamelCase__							)
							__lowerCamelCase		       =    self.image_processor


			def __call__(      self			,						lowerCamelCase__=None			,						lowerCamelCase__=None			,						lowerCamelCase__=None			,						**lowerCamelCase__							)    ->      List[str]:



							'''simple docstring'''

							if text is None and images is None:
											raise ValueError('You have to specify either text or images. Both cannot be none.'							)

							if text is not None:
											__lowerCamelCase		       =    self.tokenizer(lowerCamelCase__			,						return_tensors=lowerCamelCase__			,						**lowerCamelCase__							)

							if images is not None:
											__lowerCamelCase		       =    self.image_processor(lowerCamelCase__			,						return_tensors=lowerCamelCase__			,						**lowerCamelCase__							)

							if text is not None and images is not None:
											__lowerCamelCase		       =    image_features.pixel_values
											return encoding
							elif text is not None:
											return encoding
							else:
											return BatchEncoding(data=dict(**lowerCamelCase__							)			,						tensor_type=lowerCamelCase__							)


			def       lowercase_    (      self			,						*lowerCamelCase__			,						**lowerCamelCase__							)    ->      List[str]:



							'''simple docstring'''
							return self.tokenizer.batch_decode(*lowerCamelCase__			,						**lowerCamelCase__							)


			def       lowercase_    (      self			,						*lowerCamelCase__			,						**lowerCamelCase__							)    ->      Any:



							'''simple docstring'''
							return self.tokenizer.decode(*lowerCamelCase__			,						**lowerCamelCase__							)






			@property
			def       lowercase_    (      self							)    ->      str:



							'''simple docstring'''
							return ["input_ids", "attention_mask", "pixel_values"]








import baseaa







def 			lowerCamelCase_		(       UpperCamelCase__				:      str      )     ->       bytes:





				"""simple docstring"""


				return baseaa.aaaencode(string.encode('utf-8'      )      )







def 			lowerCamelCase_		(       UpperCamelCase__				:      bytes      )     ->       str:





				"""simple docstring"""


				return baseaa.aaadecode(UpperCamelCase__      ).decode('utf-8'      )


if __name__ == "__main__":
					import doctest

					doctest.testmod()


