Spaces:
Configuration error
Configuration error
Update app.py
Browse files
app.py
CHANGED
@@ -38,9 +38,6 @@ from TTS.tts.models import setup_model
|
|
38 |
from TTS.config import load_config
|
39 |
from TTS.tts.models.vits import *
|
40 |
|
41 |
-
import whisper
|
42 |
-
model = whisper.load_model("base")
|
43 |
-
|
44 |
os.system('pip install voicefixer --upgrade')
|
45 |
from voicefixer import VoiceFixer
|
46 |
voicefixer = VoiceFixer()
|
@@ -135,24 +132,12 @@ def compute_spec(ref_file):
|
|
135 |
|
136 |
|
137 |
|
138 |
-
def greet(apikey, Voicetoclone, VoiceMicrophone,
|
139 |
|
140 |
openai.api_key = apikey
|
141 |
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
# make log-Mel spectrogram and move to the same device as the model
|
146 |
-
mel = whisper.log_mel_spectrogram(audio).to(model.device)
|
147 |
-
|
148 |
-
# detect the spoken language
|
149 |
-
_, probs = model.detect_language(mel)
|
150 |
-
print(f"Detected language: {max(probs, key=probs.get)}")
|
151 |
-
|
152 |
-
# decode the audio
|
153 |
-
options = whisper.DecodingOptions()
|
154 |
-
result = whisper.decode(model, mel, options)
|
155 |
-
res.append(result.text)
|
156 |
|
157 |
if choice1 == "TOEFL":
|
158 |
messages = mes1
|
@@ -253,7 +238,7 @@ gr.Interface(
|
|
253 |
gr.Textbox(lines=1, label = "请填写您的OpenAI-API-key"),
|
254 |
gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
|
255 |
gr.Audio(source="microphone", streaming = True, label = "请用语音上传您喜欢的声音,语音和文件上传二选一即可", type="filepath"),
|
256 |
-
gr.
|
257 |
gr.Radio(["TOEFL", "Therapist", "Alice"], label="TOEFL Examiner, Therapist Tina, or Assistant Alice?"),
|
258 |
],
|
259 |
outputs=[
|
|
|
38 |
from TTS.config import load_config
|
39 |
from TTS.tts.models.vits import *
|
40 |
|
|
|
|
|
|
|
41 |
os.system('pip install voicefixer --upgrade')
|
42 |
from voicefixer import VoiceFixer
|
43 |
voicefixer = VoiceFixer()
|
|
|
132 |
|
133 |
|
134 |
|
135 |
+
def greet(apikey, Voicetoclone, VoiceMicrophone, Texts, choice1):
|
136 |
|
137 |
openai.api_key = apikey
|
138 |
|
139 |
+
result = Texts
|
140 |
+
res.append(result)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
|
142 |
if choice1 == "TOEFL":
|
143 |
messages = mes1
|
|
|
238 |
gr.Textbox(lines=1, label = "请填写您的OpenAI-API-key"),
|
239 |
gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
|
240 |
gr.Audio(source="microphone", streaming = True, label = "请用语音上传您喜欢的声音,语音和文件上传二选一即可", type="filepath"),
|
241 |
+
gr.Textbox(lines=3, label = "请开始对话吧!"),
|
242 |
gr.Radio(["TOEFL", "Therapist", "Alice"], label="TOEFL Examiner, Therapist Tina, or Assistant Alice?"),
|
243 |
],
|
244 |
outputs=[
|