Kevin676 commited on
Commit
d53e823
1 Parent(s): 1f1ddfc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -142,9 +142,13 @@ def greet(apikey, upload, audio, choice1):
142
 
143
  enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
144
  torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
145
- #torchaudio.save("enhanced.wav", enhanced.cpu(), sample_rate)
 
 
 
 
146
 
147
- return [result.text, chat_response, "enhanced.wav"]
148
 
149
  c1=gr.Interface(
150
  fn=greet,
@@ -159,7 +163,7 @@ c1=gr.Interface(
159
  ],
160
  #theme="huggingface",
161
  #title= "🥳💬💕 - TalktoAI,随时随地,谈天说地!"
162
- description = "让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
163
  )
164
 
165
 
@@ -176,7 +180,7 @@ c2=gr.Interface(
176
  ],
177
  #theme="huggingface",
178
  #title= "🥳💬💕 - TalktoAI,随时随地,谈天说地!"
179
- description = "让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
180
  )
181
 
182
  demo = gr.TabbedInterface([c1, c2], ["wav文件上传", "麦克风上传"])
 
142
 
143
  enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
144
  torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
145
+
146
+ voicefixer.restore(input="enhanced.wav", # input wav file path
147
+ output="audio2.wav", # output wav file path
148
+ cuda=True, # whether to use gpu acceleration
149
+ mode = 2) # You can try out mode 0, 1, or 2 to find out the best result
150
 
151
+ return [result.text, chat_response, "audio2.wav"]
152
 
153
  c1=gr.Interface(
154
  fn=greet,
 
163
  ],
164
  #theme="huggingface",
165
  #title= "🥳💬💕 - TalktoAI,随时随地,谈天说地!"
166
+ description = "🥳💬💕 - TalktoAI,随时随地,谈天说地! \n🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
167
  )
168
 
169
 
 
180
  ],
181
  #theme="huggingface",
182
  #title= "🥳💬💕 - TalktoAI,随时随地,谈天说地!"
183
+ description = "🥳💬💕 - TalktoAI,随时随地,谈天说地! \n🤖 - 让有人文关怀的AI造福每一个人!AI向善,文明璀璨!TalktoAI - Enable the future!",
184
  )
185
 
186
  demo = gr.TabbedInterface([c1, c2], ["wav文件上传", "麦克风上传"])