Kevin676 commited on
Commit
088ea2e
1 Parent(s): f3ce39f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -16
app.py CHANGED
@@ -122,21 +122,10 @@ def evaluate(
122
 
123
  res1 = ' '.join(str(x) for x in res)
124
 
125
- tts.tts_to_file(res1, speaker_wav = upload, language="en", file_path="output.wav")
126
-
127
- voicefixer.restore(input="output.wav", # input wav file path
128
- output="audio1.wav", # output wav file path
129
- cuda=True, # whether to use gpu acceleration
130
- mode = 0) # You can try out mode 0, 1, or 2 to find out the best result
131
-
132
- noisy = enhance_model.load_audio(
133
- "audio1.wav"
134
- ).unsqueeze(0)
135
 
136
- enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
137
- torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
138
-
139
- return [result.text, res, "enhanced.wav"]
140
  # yield out_str.strip()
141
 
142
  g = gr.Interface(
@@ -144,7 +133,7 @@ g = gr.Interface(
144
  inputs=[
145
  # gr.components.Textbox(lines=2, label="Instruction", value="Tell me about ravens."),
146
  gr.Audio(source="microphone", label = "请开始对话吧!", type="filepath"),
147
- gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
148
  gr.components.Textbox(lines=2, label="Input", placeholder="none"),
149
  gr.components.Slider(minimum=10, maximum=200, step=10, value=150), # token_count
150
  gr.components.Slider(minimum=0.2, maximum=2.0, step=0.1, value=1.0), # temperature
@@ -161,7 +150,7 @@ g = gr.Interface(
161
  lines=5,
162
  label="Raven Output",
163
  ),
164
- gr.Audio(label="Audio with Custom Voice"),
165
  ],
166
  title="🥳💬💕 - TalktoAI,随时随地,谈天说地!",
167
  description="🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
 
122
 
123
  res1 = ' '.join(str(x) for x in res)
124
 
 
 
 
 
 
 
 
 
 
 
125
 
126
+ return [result.text, res]
127
+
128
+ # return [result.text, res, "enhanced.wav"]
 
129
  # yield out_str.strip()
130
 
131
  g = gr.Interface(
 
133
  inputs=[
134
  # gr.components.Textbox(lines=2, label="Instruction", value="Tell me about ravens."),
135
  gr.Audio(source="microphone", label = "请开始对话吧!", type="filepath"),
136
+ # gr.Audio(source="upload", label = "请上传您喜欢的声音(wav文件)", type="filepath"),
137
  gr.components.Textbox(lines=2, label="Input", placeholder="none"),
138
  gr.components.Slider(minimum=10, maximum=200, step=10, value=150), # token_count
139
  gr.components.Slider(minimum=0.2, maximum=2.0, step=0.1, value=1.0), # temperature
 
150
  lines=5,
151
  label="Raven Output",
152
  ),
153
+ # gr.Audio(label="Audio with Custom Voice"),
154
  ],
155
  title="🥳💬💕 - TalktoAI,随时随地,谈天说地!",
156
  description="🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",