Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -57,7 +57,7 @@ def generate_prompt(instruction, input=None):
|
|
| 57 |
"""
|
| 58 |
|
| 59 |
def evaluate(
|
| 60 |
-
upload,
|
| 61 |
audio,
|
| 62 |
# instruction,
|
| 63 |
# input=None,
|
|
@@ -129,28 +129,16 @@ def evaluate(
|
|
| 129 |
|
| 130 |
res1 = ' '.join(str(x) for x in res)
|
| 131 |
|
| 132 |
-
tts.tts_to_file("hi there how are you", speaker_wav = upload, language="en", file_path="output.wav")
|
| 133 |
-
|
| 134 |
-
voicefixer.restore(input="output.wav", # input wav file path
|
| 135 |
-
output="audio1.wav", # output wav file path
|
| 136 |
-
cuda=True, # whether to use gpu acceleration
|
| 137 |
-
mode = 0) # You can try out mode 0, 1, or 2 to find out the best result
|
| 138 |
-
|
| 139 |
-
noisy = enhance_model.load_audio(
|
| 140 |
-
"audio1.wav"
|
| 141 |
-
).unsqueeze(0)
|
| 142 |
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
return [result.text, res1, "enhanced.wav"]
|
| 147 |
|
| 148 |
# yield out_str.strip()
|
| 149 |
|
| 150 |
g = gr.Interface(
|
| 151 |
fn=evaluate,
|
| 152 |
inputs=[
|
| 153 |
-
gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
|
| 154 |
gr.Audio(source="microphone", label = "和您的专属AI聊天吧!", type="filepath"),
|
| 155 |
# gr.components.Textbox(lines=2, label="Instruction", value="Tell me about ravens."),
|
| 156 |
# gr.components.Textbox(lines=2, label="Input", placeholder="none"),
|
|
@@ -163,7 +151,7 @@ g = gr.Interface(
|
|
| 163 |
outputs=[
|
| 164 |
gr.Textbox(label="Speech to Text"),
|
| 165 |
gr.Textbox(label="Raven Output"),
|
| 166 |
-
gr.Audio(label="Audio with Custom Voice"),
|
| 167 |
],
|
| 168 |
title="🥳💬💕 - TalktoAI,随时随地,谈天说地!",
|
| 169 |
description="🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
|
|
|
|
| 57 |
"""
|
| 58 |
|
| 59 |
def evaluate(
|
| 60 |
+
# upload,
|
| 61 |
audio,
|
| 62 |
# instruction,
|
| 63 |
# input=None,
|
|
|
|
| 129 |
|
| 130 |
res1 = ' '.join(str(x) for x in res)
|
| 131 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 132 |
|
| 133 |
+
|
| 134 |
+
return [result.text, res1]
|
|
|
|
|
|
|
| 135 |
|
| 136 |
# yield out_str.strip()
|
| 137 |
|
| 138 |
g = gr.Interface(
|
| 139 |
fn=evaluate,
|
| 140 |
inputs=[
|
| 141 |
+
# gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
|
| 142 |
gr.Audio(source="microphone", label = "和您的专属AI聊天吧!", type="filepath"),
|
| 143 |
# gr.components.Textbox(lines=2, label="Instruction", value="Tell me about ravens."),
|
| 144 |
# gr.components.Textbox(lines=2, label="Input", placeholder="none"),
|
|
|
|
| 151 |
outputs=[
|
| 152 |
gr.Textbox(label="Speech to Text"),
|
| 153 |
gr.Textbox(label="Raven Output"),
|
| 154 |
+
# gr.Audio(label="Audio with Custom Voice"),
|
| 155 |
],
|
| 156 |
title="🥳💬💕 - TalktoAI,随时随地,谈天说地!",
|
| 157 |
description="🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
|