Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ import torchaudio
|
|
32 |
from speechbrain.pretrained import SpectralMaskEnhancement
|
33 |
|
34 |
import whisper
|
35 |
-
model1 = whisper.load_model("
|
36 |
|
37 |
import openai
|
38 |
|
@@ -222,12 +222,12 @@ def greet(Text2, audio, Voicetoclone,VoiceMicrophone):
|
|
222 |
|
223 |
enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
|
224 |
torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
|
225 |
-
return [chat_response, "enhanced.wav"]
|
226 |
|
227 |
demo = gr.Interface(
|
228 |
fn=greet,
|
229 |
inputs=[gr.inputs.Textbox(label='请输入您的openai.api_key'), gr.Audio(source="microphone", label='在这里进行对话', type="filepath"), gr.Audio(type="filepath", source="upload",label='Please upload a voice to clone (max. 30mb)'), gr.Audio(source="microphone", type="filepath", streaming=True)],
|
230 |
-
outputs=["text", "audio"]
|
231 |
# title="TalktoAI,随时随地,谈天说地!"
|
232 |
)
|
233 |
demo.launch(show_error = True)
|
|
|
32 |
from speechbrain.pretrained import SpectralMaskEnhancement
|
33 |
|
34 |
import whisper
|
35 |
+
model1 = whisper.load_model("base")
|
36 |
|
37 |
import openai
|
38 |
|
|
|
222 |
|
223 |
enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
|
224 |
torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
|
225 |
+
return [result.text, chat_response, "enhanced.wav"]
|
226 |
|
227 |
demo = gr.Interface(
|
228 |
fn=greet,
|
229 |
inputs=[gr.inputs.Textbox(label='请输入您的openai.api_key'), gr.Audio(source="microphone", label='在这里进行对话', type="filepath"), gr.Audio(type="filepath", source="upload",label='Please upload a voice to clone (max. 30mb)'), gr.Audio(source="microphone", type="filepath", streaming=True)],
|
230 |
+
outputs=["text", "text", "audio"]
|
231 |
# title="TalktoAI,随时随地,谈天说地!"
|
232 |
)
|
233 |
demo.launch(show_error = True)
|