

import json
import os
import unittest

from transformers import CLIPTokenizer, CLIPTokenizerFast
from transformers.models.clip.tokenization_clip import VOCAB_FILES_NAMES
from transformers.testing_utils import require_ftfy, require_tokenizers

from ...test_tokenization_common import TokenizerTesterMixin






@require_tokenizers
class _UpperCamelCase							(							__A							,	unittest.TestCase   ):
			'''simple docstring'''







			lowerCamelCase__           =CLIPTokenizer
			lowerCamelCase__           =CLIPTokenizerFast
			lowerCamelCase__           =True
			lowerCamelCase__           ={}
			lowerCamelCase__           =False
			def 							__UpperCamelCase (			self							: int	)							->       List[Any]:

				"""simple docstring"""

				super().setUp()

				# fmt: off
				SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       ["l", "o", "w", "e", "r", "s", "t", "i", "d", "n", "lo", "l</w>", "w</w>", "r</w>", "t</w>", "low</w>", "er</w>", "lowest</w>", "newer</w>", "wider", "<unk>", "<|startoftext|>", "<|endoftext|>"]
				# fmt: on
				SCREAMING_SNAKE_CASE   :      Optional[int]				     =       dict(zip(a      ,      range(len(a	)	)	)	)
				SCREAMING_SNAKE_CASE   :      Dict				     =       ["#version: 0.2", "l o", "lo w</w>", "e r</w>"]
				SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       {"unk_token": "<unk>"}

				SCREAMING_SNAKE_CASE   :      Any				     =       os.path.join(self.tmpdirname      ,      VOCAB_FILES_NAMES["vocab_file"]	)
				SCREAMING_SNAKE_CASE   :      List[Any]				     =       os.path.join(self.tmpdirname      ,      VOCAB_FILES_NAMES["merges_file"]	)
				with open(self.vocab_file      ,      "w"      ,      encoding="utf-8"	) as fp:
					fp.write(json.dumps(a	) + "\n"	)
				with open(self.merges_file      ,      "w"      ,      encoding="utf-8"	) as fp:
					fp.write("\n".join(a	)	)
			def 							__UpperCamelCase (			self							: Optional[int]      ,      **a							: Tuple	)							->       Dict:

				"""simple docstring"""

				kwargs.update(self.special_tokens_map	)
				return CLIPTokenizer.from_pretrained(self.tmpdirname      ,      **a	)
			def 							__UpperCamelCase (			self							: Tuple      ,      **a							: str	)							->       Optional[int]:

				"""simple docstring"""

				kwargs.update(self.special_tokens_map	)
				return CLIPTokenizerFast.from_pretrained(self.tmpdirname      ,      **a	)
			def 							__UpperCamelCase (			self							: Tuple      ,      a							: List[str]	)							->       Optional[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      Optional[int]				     =       "lower newer"
				SCREAMING_SNAKE_CASE   :      str				     =       "lower newer"
				return input_text, output_text
			def 							__UpperCamelCase (			self							: str	)							->       Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      Dict				     =       CLIPTokenizer(self.vocab_file      ,      self.merges_file      ,      **self.special_tokens_map	)
				SCREAMING_SNAKE_CASE   :      Any				     =       "lower newer"
				SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       ["lo", "w", "er</w>", "n", "e", "w", "er</w>"]
				SCREAMING_SNAKE_CASE   :      str				     =       tokenizer.tokenize(a	)
				self.assertListEqual(a      ,      a	)

				SCREAMING_SNAKE_CASE   :      int				     =       tokens + [tokenizer.unk_token]
				SCREAMING_SNAKE_CASE   :      str				     =       [10, 2, 16, 9, 3, 2, 16, 20]
				self.assertListEqual(tokenizer.convert_tokens_to_ids(a	)      ,      a	)
			@require_ftfy
			def 							__UpperCamelCase (			self							: Union[str, Any]	)							->       Any:

				"""simple docstring"""

				for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
					with self.subTest(F"{tokenizer.__class__.__name__} ({pretrained_name})"	):
						SCREAMING_SNAKE_CASE   :      Optional[int]				     =       self.tokenizer_class.from_pretrained(a      ,      **a	)
						SCREAMING_SNAKE_CASE   :      Dict				     =       self.rust_tokenizer_class.from_pretrained(a      ,      **a	)

						SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       "A\n'll 11p223RF☆ho!!to?'d'd''d of a cat to-$''d."
						SCREAMING_SNAKE_CASE   :      Optional[int]				     =       tokenizer_s.tokenize(a	)
						SCREAMING_SNAKE_CASE   :      List[str]				     =       tokenizer_r.tokenize(a	)

						self.assertListEqual(a      ,      a	)

						# Test that the tokenization is identical on an example containing a character (Latin Small Letter A
						# with Tilde) encoded in 2 different ways
						SCREAMING_SNAKE_CASE   :      str				     =       "xa\u0303y" + " " + "x\xe3y"
						SCREAMING_SNAKE_CASE   :      str				     =       tokenizer_s.tokenize(a	)
						SCREAMING_SNAKE_CASE   :      int				     =       tokenizer_r.tokenize(a	)

						self.assertListEqual(a      ,      a	)

						# Test that the tokenization is identical on unicode of space type
						SCREAMING_SNAKE_CASE   :      Tuple				     =       [
						    "\u0009",  # (horizontal tab, '\t')
						    "\u000B",  # (vertical tab)
						    "\u000C",  # (form feed)
						    "\u0020",  # (space, ' ')
						    "\u200E",  # (left-to-right mark):w
						    "\u200F",  # (right-to-left mark)
						]
						for unicode_seq in spaces_unicodes:
							SCREAMING_SNAKE_CASE   :      Dict				     =       tokenizer_s.tokenize(a	)
							SCREAMING_SNAKE_CASE   :      List[str]				     =       tokenizer_r.tokenize(a	)

							self.assertListEqual(a      ,      a	)

						# Test that the tokenization is identical on unicode of line break type
						SCREAMING_SNAKE_CASE   :      int				     =       [
						    "\u000A",  # (line feed, '\n')
						    "\r\n",  # (carriage return and line feed, '\r\n')
						    "\u000D",  # (carriage return, '\r')
						    "\r",  # (carriage return, '\r')
						    "\u000D",  # (carriage return, '\r')
						    "\u2028",  # (line separator)
						    "\u2029",  # (paragraph separator)
						    # "\u0085", # (next line)
						]

						# The tokenization is not identical for the character "\u0085" (next line). The slow version using ftfy transforms
						# it into the Horizontal Ellipsis character "…" ("\u2026") while the fast version transforms it into a
						# space (and thus into an empty list).

						for unicode_seq in line_break_unicodes:
							SCREAMING_SNAKE_CASE   :      Dict				     =       tokenizer_s.tokenize(a	)
							SCREAMING_SNAKE_CASE   :      int				     =       tokenizer_r.tokenize(a	)

							self.assertListEqual(a      ,      a	)
			def 							__UpperCamelCase (			self							: Union[str, Any]	)							->       List[str]:

				"""simple docstring"""

				for tokenizer, pretrained_name, kwargs in self.tokenizers_list:
					with self.subTest(F"{tokenizer.__class__.__name__} ({pretrained_name})"	):
						SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       "hello"  # `hello` is a token in the vocabulary of `pretrained_name`
						SCREAMING_SNAKE_CASE   :      List[Any]				     =       F"{text_of_1_token} {text_of_1_token}"

						SCREAMING_SNAKE_CASE   :      List[Any]				     =       self.rust_tokenizer_class.from_pretrained(
						    a      ,      use_fast=a      ,      )
						SCREAMING_SNAKE_CASE   :      Tuple				     =       tokenizer_r(a      ,      return_offsets_mapping=a      ,      add_special_tokens=a	)
						self.assertEqual(encoding.offset_mapping[0]      ,      (0, len(a	))	)
						self.assertEqual(
						    encoding.offset_mapping[1]      ,      (len(a	) + 1, len(a	) + 1 + len(a	))      ,      )

						SCREAMING_SNAKE_CASE   :      Dict				     =       F" {text}"

						SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       self.rust_tokenizer_class.from_pretrained(
						    a      ,      use_fast=a      ,      )
						SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       tokenizer_r(a      ,      return_offsets_mapping=a      ,      add_special_tokens=a	)
						self.assertEqual(encoding.offset_mapping[0]      ,      (1, 1 + len(a	))	)
						self.assertEqual(
						    encoding.offset_mapping[1]      ,      (1 + len(a	) + 1, 1 + len(a	) + 1 + len(a	))      ,      )
			def 							__UpperCamelCase (			self							: List[str]	)							->       Optional[Any]:

				"""simple docstring"""

				with self.assertRaises(a	) as context:
					self.rust_tokenizer_class.from_pretrained("robot-test/old-clip-tokenizer"	)

				self.assertTrue(
				    context.exception.args[0].startswith(
				        "The `backend_tokenizer` provided does not match the expected format."	)	)
			@require_ftfy
			def 							__UpperCamelCase (			self							: Dict	)							->       int:

				"""simple docstring"""

				super().test_tokenization_python_rust_equals()






			def 							__UpperCamelCase (			self							: int	)							->       Union[str, Any]:

				"""simple docstring"""

				pass


import unittest

from transformers import MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING, AutoTokenizer, is_vision_available
from transformers.pipelines import pipeline
from transformers.pipelines.document_question_answering import apply_tesseract
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_detectrona,
    require_pytesseract,
    require_tf,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
			from PIL import Image

			from transformers.image_utils import load_image
else:






			class _UpperCamelCase							:
						'''simple docstring'''







						@staticmethod
						def 							__UpperCamelCase (			*a							: Any      ,      **a							: Optional[int]	)							->       Optional[Any]:

							"""simple docstring"""

							pass

			def  lowerCamelCase__ (					_a):
				return None


# This is a pinned image from a specific revision of a document question answering space, hosted by HuggingFace,
# so we can expect it to be available.
a_						     =    (
    'https://huggingface.co/spaces/impira/docquery/resolve/2f6c96314dc84dfda62d40de9da55f2f5165d403/invoice.png'
)






@is_pipeline_test
@require_torch
@require_vision
class _UpperCamelCase							(							unittest.TestCase   ):
			'''simple docstring'''







			lowerCamelCase__           =MODEL_FOR_DOCUMENT_QUESTION_ANSWERING_MAPPING
			@require_pytesseract
			@require_vision
			def 							__UpperCamelCase (			self							: Tuple      ,      a							: Union[str, Any]      ,      a							: Any      ,      a							: Optional[Any]	)							->       List[str]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      int				     =       pipeline(
				    "document-question-answering"      ,      model=a      ,      tokenizer=a      ,      image_processor=a	)

				SCREAMING_SNAKE_CASE   :      Dict				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      int				     =       list(zip(*apply_tesseract(load_image(a	)      ,      a      ,      ""	)	)	)
				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       "What is the placebo?"
				SCREAMING_SNAKE_CASE   :      List[str]				     =       [
				    {
				        "image": load_image(a	),
				        "question": question,
				    },
				    {
				        "image": image,
				        "question": question,
				    },
				    {
				        "image": image,
				        "question": question,
				        "word_boxes": word_boxes,
				    },
				]
				return dqa_pipeline, examples
			def 							__UpperCamelCase (			self							: List[str]      ,      a							: List[Any]      ,      a							: Any	)							->       Optional[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      Optional[int]				     =       dqa_pipeline(a      ,      top_k=2	)
				self.assertEqual(
				    a      ,      [
				        [
				            {"score": ANY(a	), "answer": ANY(a	), "start": ANY(a	), "end": ANY(a	)},
				            {"score": ANY(a	), "answer": ANY(a	), "start": ANY(a	), "end": ANY(a	)},
				        ]
				    ]
				    * 3      ,      )
			@require_torch
			@require_detectrona
			@require_pytesseract
			def 							__UpperCamelCase (			self							: Optional[int]	)							->       Optional[int]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      List[Any]				     =       pipeline("document-question-answering"      ,      model="hf-internal-testing/tiny-random-layoutlmv2"	)
				SCREAMING_SNAKE_CASE   :      int				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      int				     =       "How many cats are there?"

				SCREAMING_SNAKE_CASE   :      Optional[int]				     =       [
				    {"score": 0.0001, "answer": "oy 2312/2019", "start": 38, "end": 39},
				    {"score": 0.0001, "answer": "oy 2312/2019 DUE", "start": 38, "end": 40},
				]
				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(nested_simplify(a      ,      decimals=4	)      ,      a	)

				SCREAMING_SNAKE_CASE   :      Any				     =       dqa_pipeline({"image": image, "question": question}      ,      top_k=2	)
				self.assertEqual(nested_simplify(a      ,      decimals=4	)      ,      a	)

				# This image does not detect ANY text in it, meaning layoutlmv2 should fail.
				# Empty answer probably
				SCREAMING_SNAKE_CASE   :      Tuple				     =       "./tests/fixtures/tests_samples/COCO/000000039769.png"
				SCREAMING_SNAKE_CASE   :      str				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(a      ,      []	)

				# We can optionnally pass directly the words and bounding boxes
				SCREAMING_SNAKE_CASE   :      Optional[int]				     =       "./tests/fixtures/tests_samples/COCO/000000039769.png"
				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       []
				SCREAMING_SNAKE_CASE   :      int				     =       []
				SCREAMING_SNAKE_CASE   :      str				     =       dqa_pipeline(image=a      ,      question=a      ,      words=a      ,      boxes=a      ,      top_k=2	)
				self.assertEqual(a      ,      []	)
			@slow
			@require_torch
			@require_detectrona
			@require_pytesseract
			def 							__UpperCamelCase (			self							: Optional[int]	)							->       Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      List[Any]				     =       pipeline(
				    "document-question-answering"      ,      model="tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa"      ,      revision="9977165"      ,      )
				SCREAMING_SNAKE_CASE   :      Any				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      Any				     =       "What is the invoice number?"

				SCREAMING_SNAKE_CASE   :      Dict				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.9944, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.0009, "answer": "us-001", "start": 16, "end": 16},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       dqa_pipeline({"image": image, "question": question}      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.9944, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.0009, "answer": "us-001", "start": 16, "end": 16},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      Any				     =       dqa_pipeline(
				    [{"image": image, "question": question}, {"image": image, "question": question}]      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        [
				            {"score": 0.9944, "answer": "us-001", "start": 16, "end": 16},
				            {"score": 0.0009, "answer": "us-001", "start": 16, "end": 16},
				        ],
				    ]
				    * 2      ,      )
			@slow
			@require_torch
			@require_detectrona
			@require_pytesseract
			def 							__UpperCamelCase (			self							: Tuple	)							->       Union[str, Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       pipeline(
				    "document-question-answering"      ,      model="tiennvcs/layoutlmv2-base-uncased-finetuned-docvqa"      ,      revision="9977165"      ,      max_seq_len=50      ,      )
				SCREAMING_SNAKE_CASE   :      Optional[Any]				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      int				     =       "What is the invoice number?"

				SCREAMING_SNAKE_CASE   :      Any				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.9974, "answer": "1110212019", "start": 23, "end": 23},
				        {"score": 0.9948, "answer": "us-001", "start": 16, "end": 16},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      Tuple				     =       dqa_pipeline({"image": image, "question": question}      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.9974, "answer": "1110212019", "start": 23, "end": 23},
				        {"score": 0.9948, "answer": "us-001", "start": 16, "end": 16},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       dqa_pipeline(
				    [{"image": image, "question": question}, {"image": image, "question": question}]      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        [
				            {"score": 0.9974, "answer": "1110212019", "start": 23, "end": 23},
				            {"score": 0.9948, "answer": "us-001", "start": 16, "end": 16},
				        ]
				    ]
				    * 2      ,      )
			@slow
			@require_torch
			@require_pytesseract
			@require_vision
			def 							__UpperCamelCase (			self							: Union[str, Any]	)							->       Optional[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      Optional[int]				     =       AutoTokenizer.from_pretrained(
				    "impira/layoutlm-document-qa"      ,      revision="3dc6de3"      ,      add_prefix_space=a	)
				SCREAMING_SNAKE_CASE   :      List[str]				     =       pipeline(
				    "document-question-answering"      ,      model="impira/layoutlm-document-qa"      ,      tokenizer=a      ,      revision="3dc6de3"      ,      )
				SCREAMING_SNAKE_CASE   :      List[str]				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      int				     =       "What is the invoice number?"

				SCREAMING_SNAKE_CASE   :      str				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.4251, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.0819, "answer": "1110212019", "start": 23, "end": 23},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       dqa_pipeline({"image": image, "question": question}      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.4251, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.0819, "answer": "1110212019", "start": 23, "end": 23},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      Dict				     =       dqa_pipeline(
				    [{"image": image, "question": question}, {"image": image, "question": question}]      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        [
				            {"score": 0.4251, "answer": "us-001", "start": 16, "end": 16},
				            {"score": 0.0819, "answer": "1110212019", "start": 23, "end": 23},
				        ]
				    ]
				    * 2      ,      )

				SCREAMING_SNAKE_CASE   :      int				     =       list(zip(*apply_tesseract(load_image(a	)      ,      a      ,      ""	)	)	)

				# This model should also work if `image` is set to None
				SCREAMING_SNAKE_CASE   :      List[Any]				     =       dqa_pipeline({"image": None, "word_boxes": word_boxes, "question": question}      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.4251, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.0819, "answer": "1110212019", "start": 23, "end": 23},
				    ]      ,      )
			@slow
			@require_torch
			@require_pytesseract
			@require_vision
			def 							__UpperCamelCase (			self							: Tuple	)							->       List[Any]:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      int				     =       AutoTokenizer.from_pretrained(
				    "impira/layoutlm-document-qa"      ,      revision="3dc6de3"      ,      add_prefix_space=a	)
				SCREAMING_SNAKE_CASE   :      Dict				     =       pipeline(
				    "document-question-answering"      ,      model="impira/layoutlm-document-qa"      ,      tokenizer=a      ,      revision="3dc6de3"      ,      max_seq_len=50      ,      )
				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      List[Any]				     =       "What is the invoice number?"

				SCREAMING_SNAKE_CASE   :      Dict				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.9999, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.9998, "answer": "us-001", "start": 16, "end": 16},
				    ]      ,      )

				SCREAMING_SNAKE_CASE   :      int				     =       dqa_pipeline(
				    [{"image": image, "question": question}, {"image": image, "question": question}]      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        [
				            {"score": 0.9999, "answer": "us-001", "start": 16, "end": 16},
				            {"score": 0.9998, "answer": "us-001", "start": 16, "end": 16},
				        ]
				    ]
				    * 2      ,      )

				SCREAMING_SNAKE_CASE   :      int				     =       list(zip(*apply_tesseract(load_image(a	)      ,      a      ,      ""	)	)	)

				# This model should also work if `image` is set to None
				SCREAMING_SNAKE_CASE   :      Any				     =       dqa_pipeline({"image": None, "word_boxes": word_boxes, "question": question}      ,      top_k=2	)
				self.assertEqual(
				    nested_simplify(a      ,      decimals=4	)      ,      [
				        {"score": 0.9999, "answer": "us-001", "start": 16, "end": 16},
				        {"score": 0.9998, "answer": "us-001", "start": 16, "end": 16},
				    ]      ,      )
			@slow
			@require_torch
			def 							__UpperCamelCase (			self							: str	)							->       int:

				"""simple docstring"""

				SCREAMING_SNAKE_CASE   :      List[str]				     =       pipeline(
				    "document-question-answering"      ,      model="naver-clova-ix/donut-base-finetuned-docvqa"      ,      tokenizer=AutoTokenizer.from_pretrained("naver-clova-ix/donut-base-finetuned-docvqa"	)      ,      feature_extractor="naver-clova-ix/donut-base-finetuned-docvqa"      ,      )

				SCREAMING_SNAKE_CASE   :      int				     =       INVOICE_URL
				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       "What is the invoice number?"
				SCREAMING_SNAKE_CASE   :      Union[str, Any]				     =       dqa_pipeline(image=a      ,      question=a      ,      top_k=2	)
				self.assertEqual(nested_simplify(a      ,      decimals=4	)      ,      [{"answer": "us-001"}]	)






			@require_tf
			@unittest.skip("Document question answering not implemented in TF"	)
			def 							__UpperCamelCase (			self							: List[str]	)							->       int:

				"""simple docstring"""

				pass