Update app.py
Browse files
app.py
CHANGED
|
@@ -80,24 +80,23 @@ tone_color_converter.load_ckpt(f'{ckpt_converter_en}/checkpoint.pth')
|
|
| 80 |
|
| 81 |
|
| 82 |
def generate_audio(text, audio_ref, temperature, top_P, top_K, audio_seed_input, text_seed_input, refine_text_flag, refine_text_input):
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
message=encode_message)
|
| 101 |
|
| 102 |
return "output.wav"
|
| 103 |
|
|
|
|
| 80 |
|
| 81 |
|
| 82 |
def generate_audio(text, audio_ref, temperature, top_P, top_K, audio_seed_input, text_seed_input, refine_text_flag, refine_text_input):
|
| 83 |
+
source_se = torch.load(f'{ckpt_base_en}/en_default_se.pth').to(device)
|
| 84 |
+
reference_speaker = audio_ref
|
| 85 |
+
target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, target_dir='processed', vad=True)
|
| 86 |
+
save_path = "output.wav"
|
| 87 |
+
|
| 88 |
+
# Run the base speaker tts
|
| 89 |
+
src_path = "tmp.wav"
|
| 90 |
+
chat_tts(text, temperature, top_P, top_K, audio_seed_input, text_seed_input, refine_text_flag, refine_text_input, src_path)
|
| 91 |
+
|
| 92 |
+
# Run the tone color converter
|
| 93 |
+
encode_message = "@MyShell"
|
| 94 |
+
tone_color_converter.convert(
|
| 95 |
+
audio_src_path=src_path,
|
| 96 |
+
src_se=source_se,
|
| 97 |
+
tgt_se=target_se,
|
| 98 |
+
output_path=save_path,
|
| 99 |
+
message=encode_message)
|
|
|
|
| 100 |
|
| 101 |
return "output.wav"
|
| 102 |
|