
"""simple docstring"""
import unittest
from pathlib import Path
from tempfile import TemporaryDirectory
from unittest.mock import Mock, patch

import diffusers.utils.hub_utils







class 			a       (      unittest.TestCase     ):



 @patch('diffusers.utils.hub_utils.get_full_repo_name'    )
 def       UpperCamelCase__     (    self							,					_snake_case    ):







  """simple docstring"""






  lowerCAmelCase													=   'full_repo_name'
  with TemporaryDirectory() as tmpdir:
   # Dummy args values
   lowerCAmelCase													=   Mock()
   lowerCAmelCase													=   tmpdir
   lowerCAmelCase													=   0
   lowerCAmelCase													=   'hub_token'
   lowerCAmelCase													=   'dataset_name'
   lowerCAmelCase													=   0.01
   lowerCAmelCase													=   10_00_00
   lowerCAmelCase													=   1_00_00
   lowerCAmelCase													=   0.01
   lowerCAmelCase													=   0.02
   lowerCAmelCase													=   0.03
   lowerCAmelCase													=   0.0_005
   lowerCAmelCase													=   0.000_001
   lowerCAmelCase													=   1
   lowerCAmelCase													=   10
   lowerCAmelCase													=   0.001
   lowerCAmelCase													=   0.1
   lowerCAmelCase													=   0.2
   lowerCAmelCase													=   True

   # Model card mush be rendered and saved
   diffusers.utils.hub_utils.create_model_card(SCREAMING_SNAKE_CASE_							,					model_name='model_name'    )
   self.assertTrue((Path(SCREAMING_SNAKE_CASE_    ) / 'README.md').is_file()    )












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



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   load_tool('image-question-answering'    )
  self.tool.setup()
  lowerCAmelCase													=   load_tool('image-question-answering'							,					remote=_snake_case    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.tool(_snake_case							,					'How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.remote_tool(_snake_case							,					'How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.tool(image=_snake_case							,					question='How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )



 def       UpperCamelCase__     (    self    ):







  """simple docstring"""






  lowerCAmelCase													=   Image.open(Path(get_tests_dir('fixtures/tests_samples/COCO'    )    ) / '000000039769.png'    )
  lowerCAmelCase													=   self.remote_tool(image=_snake_case							,					question='How many cats are sleeping on the couch?'    )
  self.assertEqual(_snake_case							,					'2'    )





