
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      __A(    unittest.TestCase			):

  """simple docstring"""







  @require_torch
  def 	UpperCAmelCase_ (self						):
       UpperCamelCase__				=    pipeline(
           task="""zero-shot-audio-classification"""	,      model="""hf-internal-testing/tiny-clap-htsat-unfused"""						)
       UpperCamelCase__				=    load_dataset("""ashraq/esc50"""						)
       UpperCamelCase__				=    dataset["""train"""]["""audio"""][-1]["""array"""]
       UpperCamelCase__				=    audio_classifier(SCREAMING_SNAKE_CASE_	,      candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]						)
       self.assertEqual(
           nested_simplify(SCREAMING_SNAKE_CASE_						)	,      [{"""score""": 0.501, """label""": """Sound of a dog"""}, {"""score""": 0.499, """label""": """Sound of vaccum cleaner"""}]	,      )







  @unittest.skip("""No models are available in TF"""						)
  def 	UpperCAmelCase_ (self						):
       pass







  @slow
  @require_torch
  def 	UpperCAmelCase_ (self						):
       UpperCamelCase__				=    pipeline(
           task="""zero-shot-audio-classification"""	,      model="""laion/clap-htsat-unfused"""	,      )
       # This is an audio of a dog
       UpperCamelCase__				=    load_dataset("""ashraq/esc50"""						)
       UpperCamelCase__				=    dataset["""train"""]["""audio"""][-1]["""array"""]
       UpperCamelCase__				=    audio_classifier(SCREAMING_SNAKE_CASE_	,      candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]						)

       self.assertEqual(
           nested_simplify(SCREAMING_SNAKE_CASE_						)	,      [
               {"""score""": 0.999, """label""": """Sound of a dog"""},
               {"""score""": 0.001, """label""": """Sound of vaccum cleaner"""},
           ]	,      )

       UpperCamelCase__				=    audio_classifier([audio] * 5	,      candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]						)
       self.assertEqual(
           nested_simplify(SCREAMING_SNAKE_CASE_						)	,      [
               [
                   {"""score""": 0.999, """label""": """Sound of a dog"""},
                   {"""score""": 0.001, """label""": """Sound of vaccum cleaner"""},
               ],
           ]
           * 5	,      )
       UpperCamelCase__				=    audio_classifier(
           [audio] * 5	,      candidate_labels=["""Sound of a dog""", """Sound of vaccum cleaner"""]	,      batch_size=5						)
       self.assertEqual(
           nested_simplify(SCREAMING_SNAKE_CASE_						)	,      [
               [
                   {"""score""": 0.999, """label""": """Sound of a dog"""},
                   {"""score""": 0.001, """label""": """Sound of vaccum cleaner"""},
               ],
           ]
           * 5	,      )







  @unittest.skip("""No models are available in TF"""						)
  def 	UpperCAmelCase_ (self						):
       pass







from __future__ import annotations






def 						__magic_name__			(   __a      :	list[list[int]]						):



     '''simple docstring'''




     for i in range(1	,		len(matrix[0]						)						):
          matrix[0][i] += matrix[0][i - 1]

     # preprocessing the first column
     for i in range(1	,		len(__a						)						):
          matrix[i][0] += matrix[i - 1][0]

     # updating the path cost for current position
     for i in range(1	,		len(__a						)						):
          for j in range(1	,		len(matrix[0]						)						):
               matrix[i][j] += min(matrix[i - 1][j]	,		matrix[i][j - 1]						)

     return matrix[-1][-1]


if __name__ == "__main__":
    import doctest

    doctest.testmod()





