Vladimir Alabov commited on
Commit
ad9b68c
·
1 Parent(s): dce0849

Fix audio load #9

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -76,9 +76,6 @@ def run_inference(input_audio, speaker):
76
 
77
  inference_cmd = f"svc infer {raw_path} -m {model_path} -c {config_path} {f'-k {cluster_path} -r {cluster_ratio}' if cluster_path != '' and cluster_ratio > 0 else ''} -t {transpose} --f0-method {f0_method} -n {noise_scale} -o out.wav {'' if is_pitch_prediction_enabled else '--no-auto-predict-f0'}"
78
  print(inference_cmd)
79
- # out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
80
- # auto_predict_f0=True,
81
- # )
82
 
83
  result = subprocess.run(
84
  inference_cmd.split(),
@@ -89,7 +86,7 @@ def run_inference(input_audio, speaker):
89
  audio, sr = torchaudio.load('out.wav')
90
  out_audio = audio.cpu().numpy()[0]
91
  print(out_audio)
92
- return "Success", (sr, out_audio)
93
 
94
  if __name__ == '__main__':
95
  parser = argparse.ArgumentParser()
@@ -117,7 +114,6 @@ if __name__ == '__main__':
117
 
118
  vc_submit = gr.Button("Generate", variant="primary")
119
  with gr.Column():
120
- vc_output1 = gr.Textbox(label="Output Message")
121
- vc_output2 = gr.Audio(label="Output Audio") # Audio(label="Output Audio")
122
- vc_submit.click(run_inference, [vc_input, speaker], [vc_output1, vc_output2])
123
  app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
 
76
 
77
  inference_cmd = f"svc infer {raw_path} -m {model_path} -c {config_path} {f'-k {cluster_path} -r {cluster_ratio}' if cluster_path != '' and cluster_ratio > 0 else ''} -t {transpose} --f0-method {f0_method} -n {noise_scale} -o out.wav {'' if is_pitch_prediction_enabled else '--no-auto-predict-f0'}"
78
  print(inference_cmd)
 
 
 
79
 
80
  result = subprocess.run(
81
  inference_cmd.split(),
 
86
  audio, sr = torchaudio.load('out.wav')
87
  out_audio = audio.cpu().numpy()[0]
88
  print(out_audio)
89
+ return 'out.wav' # (sr, out_audio)
90
 
91
  if __name__ == '__main__':
92
  parser = argparse.ArgumentParser()
 
114
 
115
  vc_submit = gr.Button("Generate", variant="primary")
116
  with gr.Column():
117
+ vc_output = gr.Audio(label="Output Audio", tupe="filepath")
118
+ vc_submit.click(run_inference, [vc_input, speaker], [vc_output])
 
119
  app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)