oh-my-dear-ai commited on
Commit
8dc9c1f
·
verified ·
1 Parent(s): 7ffcd1a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -3
app.py CHANGED
@@ -344,8 +344,8 @@ def get_bert_final(phones, word2ph, norm_text,language,device):
344
 
345
  def get_ref_path_decor(func):
346
  # 为了hg部署添加的装饰函数,将参考文本的内容改为路径
347
- def inner(wav_name, *args):
348
- ref_wav_path = text_to_audio_mappings.get(wav_name, "")
349
  if not ref_wav_path:
350
  print("Audio file not found for the selected text.")
351
  return
@@ -372,7 +372,14 @@ audio_folder_path = 'audio'
372
  text_to_audio_mappings, audio_to_text_mappings = load_audio_text_mappings(audio_folder_path, 'slicer_opt.list')
373
 
374
  @get_ref_path_decor
375
- def get_tts_wav(ref_wav_path, prompt_text, prompt_language, text, text_language, how_to_cut=i18n("不切")):
 
 
 
 
 
 
 
376
  t0 = ttime()
377
  prompt_text = prompt_text.strip("\n")
378
  if (prompt_text[-1] not in splits): prompt_text += "。" if prompt_language != "en" else "."
 
344
 
345
  def get_ref_path_decor(func):
346
  # 为了hg部署添加的装饰函数,将参考文本的内容改为路径
347
+ def inner(ref_wav_content, *args):
348
+ ref_wav_path = text_to_audio_mappings.get(ref_wav_content, "")
349
  if not ref_wav_path:
350
  print("Audio file not found for the selected text.")
351
  return
 
372
  text_to_audio_mappings, audio_to_text_mappings = load_audio_text_mappings(audio_folder_path, 'slicer_opt.list')
373
 
374
  @get_ref_path_decor
375
+ def get_tts_wav(ref_wav_content, prompt_text, prompt_language, text, text_language, how_to_cut=i18n("不切")):
376
+
377
+ # Contributed for huggingface deployment
378
+ ref_wav_path = text_to_audio_mappings.get(ref_wav_content, "")
379
+ if not ref_wav_path:
380
+ print("Audio file not found for the selected text.")
381
+ return
382
+
383
  t0 = ttime()
384
  prompt_text = prompt_text.strip("\n")
385
  if (prompt_text[-1] not in splits): prompt_text += "。" if prompt_language != "en" else "."