Spaces:
Sleeping
Sleeping
Vladimir Alabov
commited on
Commit
·
ed3e5df
1
Parent(s):
e227a3a
Fix vc_fn #2
Browse files
app.py
CHANGED
@@ -24,7 +24,7 @@ def audio_postprocess(self, y):
|
|
24 |
return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
|
25 |
|
26 |
gr.Audio.postprocess = audio_postprocess
|
27 |
-
def vc_fn(input_audio, vc_transform,
|
28 |
if input_audio is None:
|
29 |
return "You need to upload an audio", None
|
30 |
sampling_rate, audio = input_audio
|
@@ -40,7 +40,7 @@ def vc_fn(input_audio, vc_transform, auto_f0):
|
|
40 |
soundfile.write(raw_path, audio, 16000, format="wav")
|
41 |
raw_path.seek(0)
|
42 |
out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
|
43 |
-
auto_predict_f0=
|
44 |
)
|
45 |
return "Success", (44100, out_audio.cpu().numpy())
|
46 |
|
@@ -95,5 +95,5 @@ if __name__ == '__main__':
|
|
95 |
with gr.Column():
|
96 |
vc_output1 = gr.Textbox(label="Output Message")
|
97 |
vc_output2 = gr.Audio(label="Output Audio")
|
98 |
-
vc_submit.click(vc_fn, [vc_input, vc_transform,
|
99 |
app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
|
|
|
24 |
return gr_processing_utils.encode_url_or_file_to_base64(data["name"])
|
25 |
|
26 |
gr.Audio.postprocess = audio_postprocess
|
27 |
+
def vc_fn(input_audio, vc_transform, voice):
|
28 |
if input_audio is None:
|
29 |
return "You need to upload an audio", None
|
30 |
sampling_rate, audio = input_audio
|
|
|
40 |
soundfile.write(raw_path, audio, 16000, format="wav")
|
41 |
raw_path.seek(0)
|
42 |
out_audio, out_sr = model.infer(sid, vc_transform, raw_path,
|
43 |
+
auto_predict_f0=True,
|
44 |
)
|
45 |
return "Success", (44100, out_audio.cpu().numpy())
|
46 |
|
|
|
95 |
with gr.Column():
|
96 |
vc_output1 = gr.Textbox(label="Output Message")
|
97 |
vc_output2 = gr.Audio(label="Output Audio")
|
98 |
+
vc_submit.click(vc_fn, [vc_input, vc_transform, voice], [vc_output1, vc_output2])
|
99 |
app.queue(concurrency_count=1, api_open=args.api).launch(share=args.share)
|