zxsipola123456 commited on
Commit
88b439a
1 Parent(s): 7c37268

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -8
app.py CHANGED
@@ -52,16 +52,9 @@ def voice_change(audio_in, audio_ref):
52
 
53
  query_seq = knn_vc.get_features(audio_in_path)
54
  matching_set = knn_vc.get_matching_set([audio_ref_path])
55
- print("query_seq shape:", query_seq.shape)
56
- print("matching_set shape:", matching_set.shape)
57
  out_wav = knn_vc.match(query_seq, matching_set, topk=4)
58
-
59
- # 确保 out_wav 是二维张量
60
- if len(out_wav.shape) == 1:
61
- out_wav = out_wav.unsqueeze(0)
62
-
63
  output_path = 'output.wav'
64
- torchaudio.save(output_path, out_wav, 16000)
65
  return output_path
66
 
67
  # 文字转语音(OpenAI)
 
52
 
53
  query_seq = knn_vc.get_features(audio_in_path)
54
  matching_set = knn_vc.get_matching_set([audio_ref_path])
 
 
55
  out_wav = knn_vc.match(query_seq, matching_set, topk=4)
 
 
 
 
 
56
  output_path = 'output.wav'
57
+ torchaudio.save(output_path, out_wav[None], 16000)
58
  return output_path
59
 
60
  # 文字转语音(OpenAI)