Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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('
|
29 |
-
audio, sr = librosa.load('
|
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('
|
36 |
-
audio_file = open('
|
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
|