



'''simple docstring'''







import unittest

from datasets import load_dataset

from transformers import load_tool

from .test_tools_common import ToolTesterMixin




class 				__lowerCAmelCase(							unittest.TestCase		,			UpperCamelCase__      ):






			def 				_lowercase	(   self  :							Optional[int]	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:Tuple										=      load_tool('document-question-answering'	)
					self.tool.setup()
					SCREAMING_SNAKE_CASE_						:Any										=      load_tool('document-question-answering'      ,       remote=SCREAMING_SNAKE_CASE	)






			def 				_lowercase	(   self  :							Any	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:int										=      load_dataset('hf-internal-testing/example-documents'      ,       split='test'	)
					SCREAMING_SNAKE_CASE_						:Tuple										=      dataset[0]['image']

					SCREAMING_SNAKE_CASE_						:Dict										=      self.tool(SCREAMING_SNAKE_CASE      ,       'When is the coffee break?'	)
					self.assertEqual(SCREAMING_SNAKE_CASE      ,       '11-14 to 11:39 a.m.'	)






			def 				_lowercase	(   self  :							Any	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      load_dataset('hf-internal-testing/example-documents'      ,       split='test'	)
					SCREAMING_SNAKE_CASE_						:Any										=      dataset[0]['image']

					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      self.remote_tool(SCREAMING_SNAKE_CASE      ,       'When is the coffee break?'	)
					self.assertEqual(SCREAMING_SNAKE_CASE      ,       '11-14 to 11:39 a.m.'	)






			def 				_lowercase	(   self  :							List[str]	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:Optional[int]										=      load_dataset('hf-internal-testing/example-documents'      ,       split='test'	)
					SCREAMING_SNAKE_CASE_						:Union[str, Any]										=      dataset[0]['image']

					self.tool(document=SCREAMING_SNAKE_CASE      ,       question='When is the coffee break?'	)






			def 				_lowercase	(   self  :							Tuple	):




					"""simple docstring"""







					SCREAMING_SNAKE_CASE_						:str										=      load_dataset('hf-internal-testing/example-documents'      ,       split='test'	)
					SCREAMING_SNAKE_CASE_						:Any										=      dataset[0]['image']

					SCREAMING_SNAKE_CASE_						:Optional[Any]										=      self.remote_tool(document=SCREAMING_SNAKE_CASE      ,       question='When is the coffee break?'	)
					self.assertEqual(SCREAMING_SNAKE_CASE      ,       '11-14 to 11:39 a.m.'	)





'''simple docstring'''



lowerCAmelCase						:		Tuple						      = '''
# Diffusers installation
! pip install diffusers transformers datasets accelerate
# To install from source instead of the last release, comment the command above and uncomment the following one.
# ! pip install git+https://github.com/huggingface/diffusers.git
'''

lowerCAmelCase						:		Tuple						      = [{'''type''': '''code''', '''content''': INSTALL_CONTENT}]