Aki004 commited on
Commit
dd7ea67
1 Parent(s): f4ffcc5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -25,15 +25,15 @@ def tts_get_voices_list():
25
  return voices
26
 
27
  def tts_mode(txt, voice):
28
- tts = asyncio.run(edge_tts.Communicate(txt, voice).save('temp\\test.mp3'))
29
- audio, sr = librosa.load('temp\\test.mp3', sr=16000, mono=True)
30
  raw_path = io.BytesIO()
31
  soundfile.write(raw_path, audio, 16000, format="wav")
32
  raw_path.seek(0)
33
  model = Svc(fr"Herta-Svc/G_10000.pth", f"Herta-Svc/config.json", device = 'cpu')
34
  out_audio, out_sr = model.infer('speaker0', 0, raw_path, auto_predict_f0 = True,)
35
- soundfile.write('temp\\xxx.wav', out_audio.cpu().numpy(), 44100)
36
- audio_file = open('temp\\xxx.wav', 'rb')
37
  audio_bytes = audio_file.read()
38
 
39
  return audio_bytes
 
25
  return voices
26
 
27
  def tts_mode(txt, voice):
28
+ tts = asyncio.run(edge_tts.Communicate(txt, voice).save('test.mp3'))
29
+ audio, sr = librosa.load('test.mp3', sr=16000, mono=True)
30
  raw_path = io.BytesIO()
31
  soundfile.write(raw_path, audio, 16000, format="wav")
32
  raw_path.seek(0)
33
  model = Svc(fr"Herta-Svc/G_10000.pth", f"Herta-Svc/config.json", device = 'cpu')
34
  out_audio, out_sr = model.infer('speaker0', 0, raw_path, auto_predict_f0 = True,)
35
+ soundfile.write('xxx.wav', out_audio.cpu().numpy(), 44100)
36
+ audio_file = open('xxx.wav', 'rb')
37
  audio_bytes = audio_file.read()
38
 
39
  return audio_bytes