Vladimir Alabov commited on
Commit
27afdea
1 Parent(s): d99b549

Fix subprocess #5

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -25,7 +25,7 @@ def audio_postprocess(self, y):
25
  return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
26
 
27
  gr.Audio.postprocess = audio_postprocess
28
- def vc_fn(input_audio, vc_transform, voice):
29
  if input_audio is None:
30
  return "You need to upload an audio", None
31
  sampling_rate, audio = input_audio
@@ -85,8 +85,9 @@ def run_inference(input_audio, speaker):
85
  stderr=subprocess.STDOUT,
86
  text=True
87
  )
88
- print(result)
89
- return "Success", "TODO" # (44100, out_audio.cpu().numpy())
 
90
 
91
  if __name__ == '__main__':
92
  parser = argparse.ArgumentParser()
@@ -110,11 +111,11 @@ if __name__ == '__main__':
110
  with gr.Row():
111
  with gr.Column():
112
  vc_input = gr.Audio(label="Input audio"+' (less than 20 seconds)' if limitation else '')
113
- speaker = gr.Dropdown(choices=speakers, visible=True)
114
 
115
  vc_submit = gr.Button("Generate", variant="primary")
116
  with gr.Column():
117
  vc_output1 = gr.Textbox(label="Output Message")
118
- vc_output2 = gr.Textbox(label="Output 2") # Audio(label="Output Audio")
119
  vc_submit.click(run_inference, [vc_input, speaker], [vc_output1, vc_output2])
120
  app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
 
25
  return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
26
 
27
  gr.Audio.postprocess = audio_postprocess
28
+ def unused_vc_fn(input_audio, vc_transform, voice):
29
  if input_audio is None:
30
  return "You need to upload an audio", None
31
  sampling_rate, audio = input_audio
 
85
  stderr=subprocess.STDOUT,
86
  text=True
87
  )
88
+ out_audio, sr = torchaudio.load('out.wav')
89
+ print(out_audio)
90
+ return "Success", (44100, out_audio.cpu().numpy())
91
 
92
  if __name__ == '__main__':
93
  parser = argparse.ArgumentParser()
 
111
  with gr.Row():
112
  with gr.Column():
113
  vc_input = gr.Audio(label="Input audio"+' (less than 20 seconds)' if limitation else '')
114
+ speaker = gr.Dropdown(label="Speaker", choices=speakers, visible=True)
115
 
116
  vc_submit = gr.Button("Generate", variant="primary")
117
  with gr.Column():
118
  vc_output1 = gr.Textbox(label="Output Message")
119
+ vc_output2 = gr.Audio(label="Output Audio") # Audio(label="Output Audio")
120
  vc_submit.click(run_inference, [vc_input, speaker], [vc_output1, vc_output2])
121
  app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)