lanlanliu commited on
Commit
240fe88
·
1 Parent(s): a50183d

modified getting pinyin method

Browse files
Files changed (1) hide show
  1. server.py +5 -2
server.py CHANGED
@@ -12,6 +12,7 @@ import jiwer
12
  import librosa
13
  from svs_utils import load_song_database, estimate_sentence_length
14
  from svs_eval import singmos_warmup, singmos_evaluation
 
15
 
16
 
17
  asr_pipeline = pipeline(
@@ -143,12 +144,14 @@ def on_click_metrics():
143
  # OWSM ctc + PER
144
  y, sr = librosa.load("tmp/response.wav", sr=16000)
145
  asr_result = asr_pipeline(y, generate_kwargs={"language": "mandarin"} )['text']
146
- hyp_pinin = lazy_pinyin(asr_result)
 
147
 
148
  with open(f"tmp/llm.txt", "r") as f:
149
  ref = f.read().replace(' ', '')
150
 
151
- ref_pinin = lazy_pinyin(ref)
 
152
  per = jiwer.wer(" ".join(ref_pinin), " ".join(hyp_pinin))
153
 
154
  audio = librosa.load(f"tmp/response.wav", sr=sample_rate)[0]
 
12
  import librosa
13
  from svs_utils import load_song_database, estimate_sentence_length
14
  from svs_eval import singmos_warmup, singmos_evaluation
15
+ from util import get_pinyin
16
 
17
 
18
  asr_pipeline = pipeline(
 
144
  # OWSM ctc + PER
145
  y, sr = librosa.load("tmp/response.wav", sr=16000)
146
  asr_result = asr_pipeline(y, generate_kwargs={"language": "mandarin"} )['text']
147
+ # hyp_pinin = lazy_pinyin(asr_result)
148
+ hyp_pinin = get_pinyin(asr_result)
149
 
150
  with open(f"tmp/llm.txt", "r") as f:
151
  ref = f.read().replace(' ', '')
152
 
153
+ # ref_pinin = lazy_pinyin(ref)
154
+ ref_pinin = get_pinyin(ref)
155
  per = jiwer.wer(" ".join(ref_pinin), " ".join(hyp_pinin))
156
 
157
  audio = librosa.load(f"tmp/response.wav", sr=sample_rate)[0]