




import itertools
import os
import random
import tempfile
import unittest

import numpy as np
from datasets import load_dataset

from transformers import is_speech_available
from transformers.testing_utils import check_json_file_has_correct_format, require_torch, require_torchaudio
from transformers.utils.import_utils import is_torch_available

from ...test_sequence_feature_extraction_common import SequenceFeatureExtractionTestMixin


if is_speech_available():
						from transformers import WhisperFeatureExtractor

if is_torch_available():
						import torch

SCREAMING_SNAKE_CASE:     Dict									= random.Random()


def 					_a							(					lowerCAmelCase    ,						lowerCAmelCase=1.0    ,						lowerCAmelCase=None    ,						lowerCAmelCase=None )->	str:
		if rng is None:
				SCREAMING_SNAKE_CASE_					      =							global_rng

		SCREAMING_SNAKE_CASE_					      =							[]
		for batch_idx in range(shape[0] ):
				values.append([] )
				for _ in range(shape[1] ):
						values[-1].append(rng.random() * scale )

		return values



@require_torch
@require_torchaudio
class    lowercase_		(unittest.TestCase ):



						def __init__(			self	:   str					,							snake_case__	:   Dict					,							snake_case__	:   int=7					,							snake_case__	:   Any=4_00					,							snake_case__	:   int=20_00					,							snake_case__	:   Dict=10					,							snake_case__	:   Any=1_60					,							snake_case__	:   str=8					,							snake_case__	:   Tuple=0.0					,							snake_case__	:   int=40_00					,							snake_case__	:   int=False					,							snake_case__	:   Dict=True					,							):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							parent
								SCREAMING_SNAKE_CASE_					      =							batch_size
								SCREAMING_SNAKE_CASE_					      =							min_seq_length
								SCREAMING_SNAKE_CASE_					      =							max_seq_length
								SCREAMING_SNAKE_CASE_					      =							(self.max_seq_length - self.min_seq_length) // (self.batch_size - 1)
								SCREAMING_SNAKE_CASE_					      =							padding_value
								SCREAMING_SNAKE_CASE_					      =							sampling_rate
								SCREAMING_SNAKE_CASE_					      =							return_attention_mask
								SCREAMING_SNAKE_CASE_					      =							do_normalize
								SCREAMING_SNAKE_CASE_					      =							feature_size
								SCREAMING_SNAKE_CASE_					      =							chunk_length
								SCREAMING_SNAKE_CASE_					      =							hop_length



						def 	__a					(			self	:   Optional[Any]  ):

								"""simple docstring"""

								return {
								    "feature_size": self.feature_size,
								    "hop_length": self.hop_length,
								    "chunk_length": self.chunk_length,
								    "padding_value": self.padding_value,
								    "sampling_rate": self.sampling_rate,
								    "return_attention_mask": self.return_attention_mask,
								    "do_normalize": self.do_normalize,
								}






						def 	__a					(			self	:   Optional[int]					,							snake_case__	:   int=False					,							snake_case__	:   str=False  ):

								"""simple docstring"""

								def _flatten(snake_case__	:   str  ):
										return list(itertools.chain(*snake_case__  )  )

								if equal_length:
										SCREAMING_SNAKE_CASE_					      =							[floats_list((self.max_seq_length, self.feature_size)  ) for _ in range(self.batch_size  )]
								else:
										# make sure that inputs increase in size
										SCREAMING_SNAKE_CASE_					      =							[
										    floats_list((x, self.feature_size)  )
										    for x in range(self.min_seq_length					,							self.max_seq_length					,							self.seq_length_diff  )
										]
								if numpify:
										SCREAMING_SNAKE_CASE_					      =							[np.asarray(snake_case__  ) for x in speech_inputs]
								return speech_inputs



@require_torch
@require_torchaudio
class    lowercase_		(SCREAMING_SNAKE_CASE__							,	unittest.TestCase ):
						lowerCAmelCase__			      =WhisperFeatureExtractor if is_speech_available() else None



						def 	__a					(			self	:   Tuple  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							WhisperFeatureExtractionTester(self  )



						def 	__a					(			self	:   str  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class(**self.feat_extract_dict  )

								with tempfile.TemporaryDirectory() as tmpdirname:
										SCREAMING_SNAKE_CASE_					      =							feat_extract_first.save_pretrained(snake_case__  )[0]
										check_json_file_has_correct_format(snake_case__  )
										SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class.from_pretrained(snake_case__  )

								SCREAMING_SNAKE_CASE_					      =							feat_extract_first.to_dict()
								SCREAMING_SNAKE_CASE_					      =							feat_extract_second.to_dict()
								SCREAMING_SNAKE_CASE_					      =							feat_extract_first.mel_filters
								SCREAMING_SNAKE_CASE_					      =							feat_extract_second.mel_filters
								self.assertTrue(np.allclose(snake_case__					,							snake_case__  )  )
								self.assertEqual(snake_case__					,							snake_case__  )



						def 	__a					(			self	:   int  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class(**self.feat_extract_dict  )

								with tempfile.TemporaryDirectory() as tmpdirname:
										SCREAMING_SNAKE_CASE_					      =							os.path.join(snake_case__					,							'feat_extract.json'  )
										feat_extract_first.to_json_file(snake_case__  )
										SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class.from_json_file(snake_case__  )

								SCREAMING_SNAKE_CASE_					      =							feat_extract_first.to_dict()
								SCREAMING_SNAKE_CASE_					      =							feat_extract_second.to_dict()
								SCREAMING_SNAKE_CASE_					      =							feat_extract_first.mel_filters
								SCREAMING_SNAKE_CASE_					      =							feat_extract_second.mel_filters
								self.assertTrue(np.allclose(snake_case__					,							snake_case__  )  )
								self.assertEqual(snake_case__					,							snake_case__  )



						def 	__a					(			self	:   Tuple  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()  )
								# create three inputs of length 800, 1000, and 1200
								SCREAMING_SNAKE_CASE_					      =							[floats_list((1, x)  )[0] for x in range(8_00					,							14_00					,							2_00  )]
								SCREAMING_SNAKE_CASE_					      =							[np.asarray(snake_case__  ) for speech_input in speech_inputs]

								# Test feature size
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							padding='max_length'					,							return_tensors='np'  ).input_features
								self.assertTrue(input_features.ndim == 3  )
								self.assertTrue(input_features.shape[-1] == feature_extractor.nb_max_frames  )
								self.assertTrue(input_features.shape[-2] == feature_extractor.feature_size  )

								# Test not batched input
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(speech_inputs[0]					,							return_tensors='np'  ).input_features
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(np_speech_inputs[0]					,							return_tensors='np'  ).input_features
								self.assertTrue(np.allclose(snake_case__					,							snake_case__					,							atol=1e-3  )  )

								# Test batched
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='np'  ).input_features
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='np'  ).input_features
								for enc_seq_a, enc_seq_a in zip(snake_case__					,							snake_case__  ):
										self.assertTrue(np.allclose(snake_case__					,							snake_case__					,							atol=1e-3  )  )

								# Test 2-D numpy arrays are batched.
								SCREAMING_SNAKE_CASE_					      =							[floats_list((1, x)  )[0] for x in (8_00, 8_00, 8_00)]
								SCREAMING_SNAKE_CASE_					      =							np.asarray(snake_case__  )
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='np'  ).input_features
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='np'  ).input_features
								for enc_seq_a, enc_seq_a in zip(snake_case__					,							snake_case__  ):
										self.assertTrue(np.allclose(snake_case__					,							snake_case__					,							atol=1e-3  )  )

								# Test truncation required
								SCREAMING_SNAKE_CASE_					      =							[floats_list((1, x)  )[0] for x in range(2_00					,							(feature_extractor.n_samples + 5_00)					,							2_00  )]
								SCREAMING_SNAKE_CASE_					      =							[np.asarray(snake_case__  ) for speech_input in speech_inputs]

								SCREAMING_SNAKE_CASE_					      =							[x[: feature_extractor.n_samples] for x in speech_inputs]
								SCREAMING_SNAKE_CASE_					      =							[np.asarray(snake_case__  ) for speech_input in speech_inputs_truncated]

								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='np'  ).input_features
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='np'  ).input_features
								for enc_seq_a, enc_seq_a in zip(snake_case__					,							snake_case__  ):
										self.assertTrue(np.allclose(snake_case__					,							snake_case__					,							atol=1e-3  )  )



						def 	__a					(			self	:   List[Any]  ):

								"""simple docstring"""

								import torch

								SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()  )
								SCREAMING_SNAKE_CASE_					      =							np.random.rand(1_00					,							32  ).astype(np.floataa  )
								SCREAMING_SNAKE_CASE_					      =							np_speech_inputs.tolist()

								for inputs in [py_speech_inputs, np_speech_inputs]:
										SCREAMING_SNAKE_CASE_					      =							feature_extractor.pad([{'input_features': inputs}]					,							return_tensors='np'  )
										self.assertTrue(np_processed.input_features.dtype == np.floataa  )
										SCREAMING_SNAKE_CASE_					      =							feature_extractor.pad([{'input_features': inputs}]					,							return_tensors='pt'  )
										self.assertTrue(pt_processed.input_features.dtype == torch.floataa  )



						def 	__a					(			self	:   Optional[Any]					,							snake_case__	:   Optional[Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							load_dataset('hf-internal-testing/librispeech_asr_dummy'					,							'clean'					,							split='validation'  )
								# automatic decoding with librispeech
								SCREAMING_SNAKE_CASE_					      =							ds.sort('id'  ).select(range(snake_case__  )  )[:num_samples]['audio']

								return [x["array"] for x in speech_samples]



						def 	__a					(			self	:   List[Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							torch.tensor(
								    [
								        0.11_93, -0.09_46, -0.10_98, -0.01_96, 0.02_25, -0.06_90, -0.17_36, 0.09_51,
								        0.09_71, -0.08_17, -0.07_02, 0.01_62, 0.02_60, 0.00_17, -0.01_92, -0.16_78,
								        0.07_09, -0.18_67, -0.06_55, -0.02_74, -0.02_34, -0.18_84, -0.05_16, -0.05_54,
								        -0.02_74, -0.14_25, -0.14_23, 0.08_37, 0.03_77, -0.08_54
								    ]  )
								# fmt: on

								SCREAMING_SNAKE_CASE_					      =							self._load_datasamples(1  )
								SCREAMING_SNAKE_CASE_					      =							WhisperFeatureExtractor()
								SCREAMING_SNAKE_CASE_					      =							feature_extractor(snake_case__					,							return_tensors='pt'  ).input_features
								self.assertEqual(input_features.shape					,							(1, 80, 30_00)  )
								self.assertTrue(torch.allclose(input_features[0, 0, :30]					,							snake_case__					,							atol=1e-4  )  )






						def 	__a					(			self	:   Union[str, Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							self.feature_extraction_class(**self.feat_extract_tester.prepare_feat_extract_dict()  )
								SCREAMING_SNAKE_CASE_					      =							self._load_datasamples(1  )[0]
								SCREAMING_SNAKE_CASE_					      =							((audio - audio.min()) / (audio.max() - audio.min())) * 6_55_35  # Rescale to [0, 65535] to show issue
								SCREAMING_SNAKE_CASE_					      =							feat_extract.zero_mean_unit_var_norm([audio]					,							attention_mask=snake_case__  )[0]

								self.assertTrue(np.all(np.mean(snake_case__  ) < 1e-3  )  )
								self.assertTrue(np.all(np.abs(np.var(snake_case__  ) - 1  ) < 1e-3  )  )





import unittest

from transformers import MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING, is_vision_available, pipeline
from transformers.testing_utils import (
    is_pipeline_test,
    nested_simplify,
    require_tf,
    require_torch,
    require_vision,
    slow,
)

from .test_pipelines_common import ANY


if is_vision_available():
						from PIL import Image
else:



						class    lowercase_		:



												@staticmethod
												def 	__a					(			*snake_case__	:   List[Any]					,							**snake_case__	:   List[Any]  ):

														"""simple docstring"""

														pass



@is_pipeline_test
@require_vision
@require_torch
class    lowercase_		(unittest.TestCase ):
						lowerCAmelCase__			      =MODEL_FOR_ZERO_SHOT_OBJECT_DETECTION_MAPPING



						def 	__a					(			self	:   Any					,							snake_case__	:   List[str]					,							snake_case__	:   int					,							snake_case__	:   Optional[int]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							pipeline(
								    'zero-shot-object-detection'					,							model='hf-internal-testing/tiny-random-owlvit-object-detection'  )

								SCREAMING_SNAKE_CASE_					      =							[
								    {
								        'image': './tests/fixtures/tests_samples/COCO/000000039769.png',
								        'candidate_labels': ['cat', 'remote', 'couch'],
								    }
								]
								return object_detector, examples



						def 	__a					(			self	:   List[Any]					,							snake_case__	:   Union[str, Any]					,							snake_case__	:   Union[str, Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							object_detector(examples[0]					,							threshold=0.0  )

								SCREAMING_SNAKE_CASE_					      =							len(snake_case__  )
								self.assertGreater(snake_case__					,							0  )
								self.assertEqual(
								    snake_case__					,							[
								        {
								            'score': ANY(snake_case__  ),
								            'label': ANY(snake_case__  ),
								            'box': {'xmin': ANY(snake_case__  ), 'ymin': ANY(snake_case__  ), 'xmax': ANY(snake_case__  ), 'ymax': ANY(snake_case__  )},
								        }
								        for i in range(snake_case__  )
								    ]					,							)



						@require_tf
						@unittest.skip('Zero Shot Object Detection not implemented in TF'  )
						def 	__a					(			self	:   Union[str, Any]  ):

								"""simple docstring"""

								pass



						@require_torch
						def 	__a					(			self	:   Tuple  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							pipeline(
								    'zero-shot-object-detection'					,							model='hf-internal-testing/tiny-random-owlvit-object-detection'  )

								SCREAMING_SNAKE_CASE_					      =							object_detector(
								    './tests/fixtures/tests_samples/COCO/000000039769.png'					,							candidate_labels=['cat', 'remote', 'couch']					,							threshold=0.64					,							)

								self.assertEqual(
								    nested_simplify(snake_case__					,							decimals=4  )					,							[
								        {'score': 0.72_35, 'label': 'cat', 'box': {'xmin': 2_04, 'ymin': 1_67, 'xmax': 2_32, 'ymax': 1_90}},
								        {'score': 0.72_18, 'label': 'remote', 'box': {'xmin': 2_04, 'ymin': 1_67, 'xmax': 2_32, 'ymax': 1_90}},
								        {'score': 0.71_84, 'label': 'couch', 'box': {'xmin': 2_04, 'ymin': 1_67, 'xmax': 2_32, 'ymax': 1_90}},
								        {'score': 0.67_48, 'label': 'remote', 'box': {'xmin': 5_71, 'ymin': 83, 'xmax': 5_98, 'ymax': 1_03}},
								        {'score': 0.66_56, 'label': 'cat', 'box': {'xmin': 5_71, 'ymin': 83, 'xmax': 5_98, 'ymax': 1_03}},
								        {'score': 0.66_14, 'label': 'couch', 'box': {'xmin': 5_71, 'ymin': 83, 'xmax': 5_98, 'ymax': 1_03}},
								        {'score': 0.64_56, 'label': 'remote', 'box': {'xmin': 4_94, 'ymin': 1_05, 'xmax': 5_21, 'ymax': 1_27}},
								        {'score': 0.6_42, 'label': 'remote', 'box': {'xmin': 67, 'ymin': 2_74, 'xmax': 93, 'ymax': 2_97}},
								        {'score': 0.64_19, 'label': 'cat', 'box': {'xmin': 4_94, 'ymin': 1_05, 'xmax': 5_21, 'ymax': 1_27}},
								    ]					,							)

								SCREAMING_SNAKE_CASE_					      =							object_detector(
								    [
								        {
								            'image': './tests/fixtures/tests_samples/COCO/000000039769.png',
								            'candidate_labels': ['cat', 'remote', 'couch'],
								        }
								    ]					,							threshold=0.64					,							)

								self.assertEqual(
								    nested_simplify(snake_case__					,							decimals=4  )					,							[
								        [
								            {'score': 0.72_35, 'label': 'cat', 'box': {'xmin': 2_04, 'ymin': 1_67, 'xmax': 2_32, 'ymax': 1_90}},
								            {'score': 0.72_18, 'label': 'remote', 'box': {'xmin': 2_04, 'ymin': 1_67, 'xmax': 2_32, 'ymax': 1_90}},
								            {'score': 0.71_84, 'label': 'couch', 'box': {'xmin': 2_04, 'ymin': 1_67, 'xmax': 2_32, 'ymax': 1_90}},
								            {'score': 0.67_48, 'label': 'remote', 'box': {'xmin': 5_71, 'ymin': 83, 'xmax': 5_98, 'ymax': 1_03}},
								            {'score': 0.66_56, 'label': 'cat', 'box': {'xmin': 5_71, 'ymin': 83, 'xmax': 5_98, 'ymax': 1_03}},
								            {'score': 0.66_14, 'label': 'couch', 'box': {'xmin': 5_71, 'ymin': 83, 'xmax': 5_98, 'ymax': 1_03}},
								            {'score': 0.64_56, 'label': 'remote', 'box': {'xmin': 4_94, 'ymin': 1_05, 'xmax': 5_21, 'ymax': 1_27}},
								            {'score': 0.6_42, 'label': 'remote', 'box': {'xmin': 67, 'ymin': 2_74, 'xmax': 93, 'ymax': 2_97}},
								            {'score': 0.64_19, 'label': 'cat', 'box': {'xmin': 4_94, 'ymin': 1_05, 'xmax': 5_21, 'ymax': 1_27}},
								        ]
								    ]					,							)



						@require_torch
						@slow
						def 	__a					(			self	:   Optional[Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							pipeline('zero-shot-object-detection'  )

								SCREAMING_SNAKE_CASE_					      =							object_detector(
								    'http://images.cocodataset.org/val2017/000000039769.jpg'					,							candidate_labels=['cat', 'remote', 'couch']					,							)
								self.assertEqual(
								    nested_simplify(snake_case__					,							decimals=4  )					,							[
								        {'score': 0.28_68, 'label': 'cat', 'box': {'xmin': 3_24, 'ymin': 20, 'xmax': 6_40, 'ymax': 3_73}},
								        {'score': 0.2_77, 'label': 'remote', 'box': {'xmin': 40, 'ymin': 72, 'xmax': 1_77, 'ymax': 1_15}},
								        {'score': 0.25_37, 'label': 'cat', 'box': {'xmin': 1, 'ymin': 55, 'xmax': 3_15, 'ymax': 4_72}},
								        {'score': 0.14_74, 'label': 'remote', 'box': {'xmin': 3_35, 'ymin': 74, 'xmax': 3_71, 'ymax': 1_87}},
								        {'score': 0.12_08, 'label': 'couch', 'box': {'xmin': 4, 'ymin': 0, 'xmax': 6_42, 'ymax': 4_76}},
								    ]					,							)

								SCREAMING_SNAKE_CASE_					      =							object_detector(
								    [
								        {
								            'image': 'http://images.cocodataset.org/val2017/000000039769.jpg',
								            'candidate_labels': ['cat', 'remote', 'couch'],
								        },
								        {
								            'image': 'http://images.cocodataset.org/val2017/000000039769.jpg',
								            'candidate_labels': ['cat', 'remote', 'couch'],
								        },
								    ]					,							)
								self.assertEqual(
								    nested_simplify(snake_case__					,							decimals=4  )					,							[
								        [
								            {'score': 0.28_68, 'label': 'cat', 'box': {'xmin': 3_24, 'ymin': 20, 'xmax': 6_40, 'ymax': 3_73}},
								            {'score': 0.2_77, 'label': 'remote', 'box': {'xmin': 40, 'ymin': 72, 'xmax': 1_77, 'ymax': 1_15}},
								            {'score': 0.25_37, 'label': 'cat', 'box': {'xmin': 1, 'ymin': 55, 'xmax': 3_15, 'ymax': 4_72}},
								            {'score': 0.14_74, 'label': 'remote', 'box': {'xmin': 3_35, 'ymin': 74, 'xmax': 3_71, 'ymax': 1_87}},
								            {'score': 0.12_08, 'label': 'couch', 'box': {'xmin': 4, 'ymin': 0, 'xmax': 6_42, 'ymax': 4_76}},
								        ],
								        [
								            {'score': 0.28_68, 'label': 'cat', 'box': {'xmin': 3_24, 'ymin': 20, 'xmax': 6_40, 'ymax': 3_73}},
								            {'score': 0.2_77, 'label': 'remote', 'box': {'xmin': 40, 'ymin': 72, 'xmax': 1_77, 'ymax': 1_15}},
								            {'score': 0.25_37, 'label': 'cat', 'box': {'xmin': 1, 'ymin': 55, 'xmax': 3_15, 'ymax': 4_72}},
								            {'score': 0.14_74, 'label': 'remote', 'box': {'xmin': 3_35, 'ymin': 74, 'xmax': 3_71, 'ymax': 1_87}},
								            {'score': 0.12_08, 'label': 'couch', 'box': {'xmin': 4, 'ymin': 0, 'xmax': 6_42, 'ymax': 4_76}},
								        ],
								    ]					,							)



						@require_tf
						@unittest.skip('Zero Shot Object Detection not implemented in TF'  )
						def 	__a					(			self	:   Union[str, Any]  ):

								"""simple docstring"""

								pass



						@require_torch
						@slow
						def 	__a					(			self	:   Union[str, Any]  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							0.2
								SCREAMING_SNAKE_CASE_					      =							pipeline('zero-shot-object-detection'  )

								SCREAMING_SNAKE_CASE_					      =							object_detector(
								    'http://images.cocodataset.org/val2017/000000039769.jpg'					,							candidate_labels=['cat', 'remote', 'couch']					,							threshold=snake_case__					,							)
								self.assertEqual(
								    nested_simplify(snake_case__					,							decimals=4  )					,							[
								        {'score': 0.28_68, 'label': 'cat', 'box': {'xmin': 3_24, 'ymin': 20, 'xmax': 6_40, 'ymax': 3_73}},
								        {'score': 0.2_77, 'label': 'remote', 'box': {'xmin': 40, 'ymin': 72, 'xmax': 1_77, 'ymax': 1_15}},
								        {'score': 0.25_37, 'label': 'cat', 'box': {'xmin': 1, 'ymin': 55, 'xmax': 3_15, 'ymax': 4_72}},
								    ]					,							)






						@require_torch
						@slow
						def 	__a					(			self	:   Tuple  ):

								"""simple docstring"""

								SCREAMING_SNAKE_CASE_					      =							2
								SCREAMING_SNAKE_CASE_					      =							pipeline('zero-shot-object-detection'  )

								SCREAMING_SNAKE_CASE_					      =							object_detector(
								    'http://images.cocodataset.org/val2017/000000039769.jpg'					,							candidate_labels=['cat', 'remote', 'couch']					,							top_k=snake_case__					,							)
								self.assertEqual(
								    nested_simplify(snake_case__					,							decimals=4  )					,							[
								        {'score': 0.28_68, 'label': 'cat', 'box': {'xmin': 3_24, 'ymin': 20, 'xmax': 6_40, 'ymax': 3_73}},
								        {'score': 0.2_77, 'label': 'remote', 'box': {'xmin': 40, 'ymin': 72, 'xmax': 1_77, 'ymax': 1_15}},
								    ]					,							)