jhj0517 commited on
Commit
5fee9a3
·
1 Parent(s): 4ceaed1

Caculate wer

Browse files
Files changed (2) hide show
  1. .github/workflows/ci.yml +1 -1
  2. tests/test_config.py +8 -4
.github/workflows/ci.yml CHANGED
@@ -37,7 +37,7 @@ jobs:
37
  run: sudo apt-get update && sudo apt-get install -y git ffmpeg
38
 
39
  - name: Install dependencies
40
- run: pip install -r requirements.txt pytest
41
 
42
  - name: Run test
43
  run: python -m pytest -rs tests
 
37
  run: sudo apt-get update && sudo apt-get install -y git ffmpeg
38
 
39
  - name: Install dependencies
40
+ run: pip install -r requirements.txt pytest jiwer
41
 
42
  - name: Run test
43
  run: python -m pytest -rs tests
tests/test_config.py CHANGED
@@ -1,15 +1,16 @@
1
  import functools
 
 
 
2
 
3
  from modules.utils.paths import *
4
  from modules.utils.youtube_manager import *
5
 
6
- import os
7
- import torch
8
-
9
  TEST_FILE_DOWNLOAD_URL = "https://github.com/jhj0517/whisper_flutter_new/raw/main/example/assets/jfk.wav"
10
  TEST_FILE_PATH = os.path.join(WEBUI_DIR, "tests", "jfk.wav")
 
11
  TEST_YOUTUBE_URL = "https://www.youtube.com/watch?v=4WEQtgnBu0I&ab_channel=AndriaFitzer"
12
- TEST_WHISPER_MODEL = "tiny.en"
13
  TEST_UVR_MODEL = "UVR-MDX-NET-Inst_HQ_4"
14
  TEST_NLLB_MODEL = "facebook/nllb-200-distilled-600M"
15
  TEST_SUBTITLE_SRT_PATH = os.path.join(WEBUI_DIR, "tests", "test_srt.srt")
@@ -34,3 +35,6 @@ def is_pytube_detected_bot(url: str = TEST_YOUTUBE_URL):
34
  print(f"Pytube has detected as a bot: {e}")
35
  return True
36
 
 
 
 
 
1
  import functools
2
+ import jiwer
3
+ import os
4
+ import torch
5
 
6
  from modules.utils.paths import *
7
  from modules.utils.youtube_manager import *
8
 
 
 
 
9
  TEST_FILE_DOWNLOAD_URL = "https://github.com/jhj0517/whisper_flutter_new/raw/main/example/assets/jfk.wav"
10
  TEST_FILE_PATH = os.path.join(WEBUI_DIR, "tests", "jfk.wav")
11
+ TEST_ANSWER = "And so my fellow Americans ask not what your country can do for you ask what you can do for your country"
12
  TEST_YOUTUBE_URL = "https://www.youtube.com/watch?v=4WEQtgnBu0I&ab_channel=AndriaFitzer"
13
+ TEST_WHISPER_MODEL = "tiny"
14
  TEST_UVR_MODEL = "UVR-MDX-NET-Inst_HQ_4"
15
  TEST_NLLB_MODEL = "facebook/nllb-200-distilled-600M"
16
  TEST_SUBTITLE_SRT_PATH = os.path.join(WEBUI_DIR, "tests", "test_srt.srt")
 
35
  print(f"Pytube has detected as a bot: {e}")
36
  return True
37
 
38
+
39
+ def calculate_wer(answer, prediction):
40
+ return jiwer.wer(answer, prediction)