Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
@@ -39,9 +39,8 @@ from scipy.io.wavfile import write, read
|
|
39 |
|
40 |
import subprocess
|
41 |
|
42 |
-
|
43 |
-
|
44 |
-
tts = TTS(model_name="tts_models/zh-CN/baker/tacotron2-DDC-GST", progress_bar=False, gpu=True)
|
45 |
import whisper
|
46 |
model = whisper.load_model("small")
|
47 |
os.system('pip install voicefixer --upgrade')
|
@@ -62,11 +61,11 @@ mes1 = [
|
|
62 |
]
|
63 |
|
64 |
mes2 = [
|
65 |
-
{"role": "system", "content": "You are a mental health therapist. Your name is Tina."}
|
66 |
]
|
67 |
|
68 |
mes3 = [
|
69 |
-
{"role": "system", "content": "You are my personal assistant. Your name is Alice."}
|
70 |
]
|
71 |
|
72 |
res = []
|
@@ -190,9 +189,10 @@ def voice_conversion(apikey, ta, audio, choice1):
|
|
190 |
|
191 |
chat_response = completion.choices[0].message.content
|
192 |
|
193 |
-
messages.append({"role": "assistant", "content": chat_response})
|
194 |
|
195 |
-
tts
|
|
|
196 |
|
197 |
target_audio = "target.wav"
|
198 |
reference_audio = "output.wav"
|
|
|
39 |
|
40 |
import subprocess
|
41 |
|
42 |
+
from gtts import gTTS
|
43 |
+
|
|
|
44 |
import whisper
|
45 |
model = whisper.load_model("small")
|
46 |
os.system('pip install voicefixer --upgrade')
|
|
|
61 |
]
|
62 |
|
63 |
mes2 = [
|
64 |
+
{"role": "system", "content": "You are a mental health therapist. Respond to me only in Chinese. Your name is Tina."}
|
65 |
]
|
66 |
|
67 |
mes3 = [
|
68 |
+
{"role": "system", "content": "You are my personal assistant. Respond to me only in Chinese. Your name is Alice."}
|
69 |
]
|
70 |
|
71 |
res = []
|
|
|
189 |
|
190 |
chat_response = completion.choices[0].message.content
|
191 |
|
192 |
+
messages.append({"role": "assistant", "content": chat_response})
|
193 |
|
194 |
+
tts = gTTS(chat_response, lang='zh-CN')
|
195 |
+
tts.save("output.wav")
|
196 |
|
197 |
target_audio = "target.wav"
|
198 |
reference_audio = "output.wav"
|