Kevin676 commited on
Commit
b821c68
·
1 Parent(s): 918efa1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -11
app.py CHANGED
@@ -175,7 +175,7 @@ def greet(apikey,Voicetoclone,VoiceMicrophone, audio, choice1):
175
 
176
  messages.append({"role": "assistant", "content": chat_response})
177
 
178
- text= "%s" % (chat_response)
179
  if Voicetoclone is not None:
180
  reference_files= "%s" % (Voicetoclone)
181
  print("path url")
@@ -226,21 +226,21 @@ def greet(apikey,Voicetoclone,VoiceMicrophone, audio, choice1):
226
  print(" > Saving output to {}".format(out_path))
227
  ap.save_wav(wav, out_path)
228
 
229
- voicefixer.restore(input=out_path, # input wav file path
230
- output="audio1.wav", # output wav file path
231
- cuda=True, # whether to use gpu acceleration
232
- mode = 0) # You can try out mode 0, 1 to find out the best result
233
 
234
 
235
 
236
- noisy = enhance_model.load_audio(
237
- "audio1.wav"
238
- ).unsqueeze(0)
239
 
240
- enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
241
- torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
242
 
243
- return [result.text, chat_response, "enhanced.wav"]
244
 
245
  output_1 = gr.Textbox(label="Speech to Text")
246
  output_2 = gr.Textbox(label="ChatGPT Output")
 
175
 
176
  messages.append({"role": "assistant", "content": chat_response})
177
 
178
+ text = chat_response
179
  if Voicetoclone is not None:
180
  reference_files= "%s" % (Voicetoclone)
181
  print("path url")
 
226
  print(" > Saving output to {}".format(out_path))
227
  ap.save_wav(wav, out_path)
228
 
229
+ # voicefixer.restore(input=out_path, # input wav file path
230
+ # output="audio1.wav", # output wav file path
231
+ # cuda=True, # whether to use gpu acceleration
232
+ # mode = 0) # You can try out mode 0, 1 to find out the best result
233
 
234
 
235
 
236
+ # noisy = enhance_model.load_audio(
237
+ # "audio1.wav"
238
+ # ).unsqueeze(0)
239
 
240
+ # enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
241
+ # torchaudio.save("enhanced.wav", enhanced.cpu(), 16000)
242
 
243
+ return [result.text, chat_response, out_path]
244
 
245
  output_1 = gr.Textbox(label="Speech to Text")
246
  output_2 = gr.Textbox(label="ChatGPT Output")