Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ from llama_cpp import Llama
|
|
3 |
import os
|
4 |
from groq import Groq
|
5 |
import numpy as np
|
|
|
6 |
|
7 |
#tts
|
8 |
from balacoon_tts import TTS
|
@@ -46,9 +47,12 @@ llm = Llama.from_pretrained(
|
|
46 |
def text_to_speech(text):
|
47 |
with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as temp_file:
|
48 |
with locker:
|
49 |
-
audio_data = tts.synthesize(text, "92")
|
50 |
-
|
51 |
-
|
|
|
|
|
|
|
52 |
|
53 |
def combine_audio_files(audio_files):
|
54 |
combined = AudioSegment.empty()
|
|
|
3 |
import os
|
4 |
from groq import Groq
|
5 |
import numpy as np
|
6 |
+
from scipy.io import wavfile
|
7 |
|
8 |
#tts
|
9 |
from balacoon_tts import TTS
|
|
|
47 |
def text_to_speech(text):
|
48 |
with tempfile.NamedTemporaryFile(delete=False, suffix='.wav') as temp_file:
|
49 |
with locker:
|
50 |
+
audio_data, sample_rate = tts.synthesize(text, "92")
|
51 |
+
audio_data_int16 = (audio_data * 32767).astype(np.int16)
|
52 |
+
output_file = temp_file.name
|
53 |
+
wavfile.write(output_file, sample_rate, audio_data_int16)
|
54 |
+
return output_file
|
55 |
+
|
56 |
|
57 |
def combine_audio_files(audio_files):
|
58 |
combined = AudioSegment.empty()
|