From d80ac2fd2df4e7fb8a28acfa512bb11472b5cc99 Mon Sep 17 00:00:00 2001
From: liugz18 <57401541+liugz18@users.noreply.github.com>
Date: 星期四, 18 七月 2024 21:34:55 +0800
Subject: [PATCH] Rename 'res' in line 514 to avoid with naming conflict with line 365

---
 tests/test_sv_inference_pipeline.py |   36 +++++++++++++++++++++++-------------
 1 files changed, 23 insertions(+), 13 deletions(-)

diff --git a/tests/test_sv_inference_pipeline.py b/tests/test_sv_inference_pipeline.py
index 60ece2d..76754ab 100644
--- a/tests/test_sv_inference_pipeline.py
+++ b/tests/test_sv_inference_pipeline.py
@@ -12,27 +12,37 @@
     def test_funasr_path(self):
         import funasr
         import os
+
         logger.info("run_dir:{0} ; funasr_path: {1}".format(os.getcwd(), funasr.__file__))
 
     def test_inference_pipeline(self):
         inference_sv_pipline = pipeline(
             task=Tasks.speaker_verification,
-            model='damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch'
+            model="damo/speech_xvector_sv-zh-cn-cnceleb-16k-spk3465-pytorch",
         )
 
         # the same speaker
-        rec_result = inference_sv_pipline(audio_in=(
-            'https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_enroll.wav',
-            'https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_same.wav'))
-        assert abs(rec_result["scores"][0]-0.85) < 0.1 and abs(rec_result["scores"][1]-0.14) < 0.1
-        logger.info(f"Similarity {rec_result['scores']}")
-    
-        # different speaker
-        rec_result = inference_sv_pipline(audio_in=(
-            'https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_enroll.wav',
-            'https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_different.wav'))
-        assert abs(rec_result["scores"][0]-0.0) < 0.1 and abs(rec_result["scores"][1]-1.0) < 0.1
+        rec_result = inference_sv_pipline(
+            audio_in=(
+                "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_enroll.wav",
+                "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_same.wav",
+            )
+        )
+        assert (
+            abs(rec_result["scores"][0] - 0.85) < 0.1 and abs(rec_result["scores"][1] - 0.14) < 0.1
+        )
         logger.info(f"Similarity {rec_result['scores']}")
 
-if __name__ == '__main__':
+        # different speaker
+        rec_result = inference_sv_pipline(
+            audio_in=(
+                "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_enroll.wav",
+                "https://isv-data.oss-cn-hangzhou.aliyuncs.com/ics/MaaS/ASR/test_audio/sv_example_different.wav",
+            )
+        )
+        assert abs(rec_result["scores"][0] - 0.0) < 0.1 and abs(rec_result["scores"][1] - 1.0) < 0.1
+        logger.info(f"Similarity {rec_result['scores']}")
+
+
+if __name__ == "__main__":
     unittest.main()

--
Gitblit v1.9.1