


"""simple docstring"""


import unittest

from datasets import load_dataset

from transformers.pipelines import pipeline
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow
@is_pipeline_test
@require_torch
class snake_case      (  unittest.TestCase):







  @require_torch
  def  a_ (					self      :       Tuple		)       ->						Optional[Any]:





      '''simple docstring'''







      _A					  =			pipeline(
          task="zero-shot-audio-classification"    ,   model="hf-internal-testing/tiny-clap-htsat-unfused"		)
      _A					  =			load_dataset("ashraq/esc50"		)
      _A					  =			dataset["train"]["audio"][-1]["array"]
      _A					  =			audio_classifier(a__    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]		)
      self.assertEqual(
          nested_simplify(a__		)    ,   [{"score": 0.5_0_1, "label": "Sound of a dog"}, {"score": 0.4_9_9, "label": "Sound of vaccum cleaner"}]    ,   )







  @unittest.skip("No models are available in TF"		)
  def  a_ (					self      :       Union[str, Any]		)       ->						Tuple:





      '''simple docstring'''







      pass







  @slow
  @require_torch
  def  a_ (					self      :       str		)       ->						Tuple:





      '''simple docstring'''







      _A					  =			pipeline(
          task="zero-shot-audio-classification"    ,   model="laion/clap-htsat-unfused"    ,   )
      # This is an audio of a dog
      _A					  =			load_dataset("ashraq/esc50"		)
      _A					  =			dataset["train"]["audio"][-1]["array"]
      _A					  =			audio_classifier(a__    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]		)

      self.assertEqual(
          nested_simplify(a__		)    ,   [
              {"score": 0.9_9_9, "label": "Sound of a dog"},
              {"score": 0.0_0_1, "label": "Sound of vaccum cleaner"},
          ]    ,   )

      _A					  =			audio_classifier([audio] * 5    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]		)
      self.assertEqual(
          nested_simplify(a__		)    ,   [
              [
                  {"score": 0.9_9_9, "label": "Sound of a dog"},
                  {"score": 0.0_0_1, "label": "Sound of vaccum cleaner"},
              ],
          ]
          * 5    ,   )
      _A					  =			audio_classifier(
          [audio] * 5    ,   candidate_labels=["Sound of a dog", "Sound of vaccum cleaner"]    ,   batch_size=5		)
      self.assertEqual(
          nested_simplify(a__		)    ,   [
              [
                  {"score": 0.9_9_9, "label": "Sound of a dog"},
                  {"score": 0.0_0_1, "label": "Sound of vaccum cleaner"},
              ],
          ]
          * 5    ,   )







  @unittest.skip("No models are available in TF"		)
  def  a_ (					self      :       Optional[Any]		)       ->						str:





      '''simple docstring'''







      pass



"""simple docstring"""


import warnings

from ...utils import logging
from .image_processing_glpn import GLPNImageProcessor


a_       							=    logging.get_logger(__name__)
class snake_case      (  _UpperCamelCase):







		def __init__(					self      :       str    ,   *a__      :       Dict    ,   **a__      :       Optional[int]		)       ->						None:





						'''simple docstring'''







						warnings.warn(
						    "The class GLPNFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please"
						    " use GLPNImageProcessor instead."    ,   a__    ,   )
						super().__init__(*a__    ,   **a__		)