kevinwang676 commited on
Commit
79e9146
1 Parent(s): 132e7e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -9
app.py CHANGED
@@ -34,7 +34,12 @@ def voice_change(audio_in, audio_ref):
34
  matching_set = knn_vc.get_matching_set(["./audio_ref.wav"])
35
  out_wav = knn_vc.match(query_seq, matching_set, topk=4)
36
  torchaudio.save('output.wav', out_wav[None], 16000)
37
- return 'output.wav'
 
 
 
 
 
38
 
39
 
40
  def tts(text, model, voice, api_key):
@@ -61,14 +66,7 @@ def tts(text, model, voice, api_key):
61
 
62
  # Get the file path of the temp file
63
  temp_file_path = temp_file.name
64
-
65
- noisy = enhance_model.load_audio(
66
- temp_file_path
67
- ).unsqueeze(0)
68
- enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
69
- torchaudio.save('enhanced.wav', enhanced.cpu(), 16000)
70
- return 'enhanced.wav'
71
-
72
  return temp_file_path
73
 
74
 
 
34
  matching_set = knn_vc.get_matching_set(["./audio_ref.wav"])
35
  out_wav = knn_vc.match(query_seq, matching_set, topk=4)
36
  torchaudio.save('output.wav', out_wav[None], 16000)
37
+ noisy = enhance_model.load_audio(
38
+ 'output.wav'
39
+ ).unsqueeze(0)
40
+ enhanced = enhance_model.enhance_batch(noisy, lengths=torch.tensor([1.]))
41
+ torchaudio.save('enhanced.wav', enhanced.cpu(), 16000)
42
+ return 'enhanced.wav'
43
 
44
 
45
  def tts(text, model, voice, api_key):
 
66
 
67
  # Get the file path of the temp file
68
  temp_file_path = temp_file.name
69
+
 
 
 
 
 
 
 
70
  return temp_file_path
71
 
72