Hilley commited on
Commit
1f69552
1 Parent(s): 066aa15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -18
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
- if style_mode=="default":
84
- source_se = torch.load(f'{ckpt_base_en}/en_default_se.pth').to(device)
85
- reference_speaker = audio_ref
86
- target_se, audio_name = se_extractor.get_se(reference_speaker, tone_color_converter, target_dir='processed', vad=True)
87
- save_path = "output.wav"
88
-
89
- # Run the base speaker tts
90
- src_path = "tmp.wav"
91
- chat_tts(text, temperature, top_P, top_K, audio_seed_input, text_seed_input, refine_text_flag, refine_text_input, src_path)
92
-
93
- # Run the tone color converter
94
- encode_message = "@MyShell"
95
- tone_color_converter.convert(
96
- audio_src_path=src_path,
97
- src_se=source_se,
98
- tgt_se=target_se,
99
- output_path=save_path,
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