Spaces:
Running
Running
back one eol
Browse files
app.py
CHANGED
|
@@ -18,11 +18,11 @@ MODEL_CACHE = {
|
|
| 18 |
datamix = AudioMixer()
|
| 19 |
|
| 20 |
|
| 21 |
-
def gradio_TSE(input_audio_path, enroll_audio_path1,
|
| 22 |
print(f"模型选择: {model_select}")
|
| 23 |
print(f"User uploaded audio path: {input_audio_path}")
|
| 24 |
print(f"User enroll audio path: {enroll_audio_path1}")
|
| 25 |
-
print(f"User enroll audio path: {enroll_audio_path2}")
|
| 26 |
|
| 27 |
# if model_select == "base_model":
|
| 28 |
# cfg_path = "config/config_base.yaml"
|
|
@@ -39,8 +39,8 @@ def gradio_TSE(input_audio_path, enroll_audio_path1, enroll_audio_path2, audio_t
|
|
| 39 |
eol_info = sf.info(enroll_audio_path1)
|
| 40 |
print(f"采样率: {eol_info.samplerate} Hz")
|
| 41 |
|
| 42 |
-
eol_info = sf.info(enroll_audio_path2)
|
| 43 |
-
print(f"采样率: {eol_info.samplerate} Hz")
|
| 44 |
|
| 45 |
input_deal_wav = fix_audio_format(input_audio_path)
|
| 46 |
input_deal_wav_path = "deal_input.wav"
|
|
@@ -58,10 +58,10 @@ def gradio_TSE(input_audio_path, enroll_audio_path1, enroll_audio_path2, audio_t
|
|
| 58 |
# eol_wav2 = "eol2.wav"
|
| 59 |
# sf.write(eol_wav2, enroll_wav2, 16000)
|
| 60 |
# else:
|
| 61 |
-
enroll_wav2 = fix_audio_format(enroll_audio_path2)
|
| 62 |
-
print("成功导入 enroll_wav2,长度:", len(enroll_wav2))
|
| 63 |
-
eol_wav2 = "eol2.wav"
|
| 64 |
-
sf.write(eol_wav2, enroll_wav2, 16000)
|
| 65 |
|
| 66 |
if audio_type == "clean":
|
| 67 |
noise_folder_test = "noises/"
|
|
@@ -75,9 +75,9 @@ def gradio_TSE(input_audio_path, enroll_audio_path1, enroll_audio_path2, audio_t
|
|
| 75 |
|
| 76 |
est_path1 = inter.run_inference(mix_path, eol_wav1)
|
| 77 |
|
| 78 |
-
est_path2 = inter.run_inference(mix_path, eol_wav2)
|
| 79 |
|
| 80 |
-
return mix_path,est_path1
|
| 81 |
|
| 82 |
|
| 83 |
|
|
@@ -104,7 +104,7 @@ with gr.Blocks() as demo:
|
|
| 104 |
with gr.Row():
|
| 105 |
|
| 106 |
enroll_audio1 = gr.Audio(label="Upload your first enroll audio", type="filepath")
|
| 107 |
-
enroll_audio2 = gr.Audio(label="Upload your second enroll audio to compare", type="filepath")
|
| 108 |
|
| 109 |
with gr.Row():
|
| 110 |
|
|
@@ -112,13 +112,13 @@ with gr.Blocks() as demo:
|
|
| 112 |
|
| 113 |
with gr.Row():
|
| 114 |
extracted_audio_output1 = gr.Audio(label="First enroll extracted target speaker audio", type="filepath")
|
| 115 |
-
extracted_audio_output2 = gr.Audio(label="Second enroll extracted target speaker audio", type="filepath")
|
| 116 |
|
| 117 |
convert_button = gr.Button("Extract")
|
| 118 |
convert_button.click(
|
| 119 |
fn=gradio_TSE,
|
| 120 |
-
inputs=[input_audio, enroll_audio1,
|
| 121 |
-
outputs=[noisy_audio_output, extracted_audio_output1
|
| 122 |
)
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|
|
|
|
| 18 |
datamix = AudioMixer()
|
| 19 |
|
| 20 |
|
| 21 |
+
def gradio_TSE(input_audio_path, enroll_audio_path1, audio_type, model_select):
|
| 22 |
print(f"模型选择: {model_select}")
|
| 23 |
print(f"User uploaded audio path: {input_audio_path}")
|
| 24 |
print(f"User enroll audio path: {enroll_audio_path1}")
|
| 25 |
+
# print(f"User enroll audio path: {enroll_audio_path2}")
|
| 26 |
|
| 27 |
# if model_select == "base_model":
|
| 28 |
# cfg_path = "config/config_base.yaml"
|
|
|
|
| 39 |
eol_info = sf.info(enroll_audio_path1)
|
| 40 |
print(f"采样率: {eol_info.samplerate} Hz")
|
| 41 |
|
| 42 |
+
# eol_info = sf.info(enroll_audio_path2)
|
| 43 |
+
# print(f"采样率: {eol_info.samplerate} Hz")
|
| 44 |
|
| 45 |
input_deal_wav = fix_audio_format(input_audio_path)
|
| 46 |
input_deal_wav_path = "deal_input.wav"
|
|
|
|
| 58 |
# eol_wav2 = "eol2.wav"
|
| 59 |
# sf.write(eol_wav2, enroll_wav2, 16000)
|
| 60 |
# else:
|
| 61 |
+
# enroll_wav2 = fix_audio_format(enroll_audio_path2)
|
| 62 |
+
# print("成功导入 enroll_wav2,长度:", len(enroll_wav2))
|
| 63 |
+
# eol_wav2 = "eol2.wav"
|
| 64 |
+
# sf.write(eol_wav2, enroll_wav2, 16000)
|
| 65 |
|
| 66 |
if audio_type == "clean":
|
| 67 |
noise_folder_test = "noises/"
|
|
|
|
| 75 |
|
| 76 |
est_path1 = inter.run_inference(mix_path, eol_wav1)
|
| 77 |
|
| 78 |
+
# est_path2 = inter.run_inference(mix_path, eol_wav2)
|
| 79 |
|
| 80 |
+
return mix_path,est_path1
|
| 81 |
|
| 82 |
|
| 83 |
|
|
|
|
| 104 |
with gr.Row():
|
| 105 |
|
| 106 |
enroll_audio1 = gr.Audio(label="Upload your first enroll audio", type="filepath")
|
| 107 |
+
# enroll_audio2 = gr.Audio(label="Upload your second enroll audio to compare", type="filepath")
|
| 108 |
|
| 109 |
with gr.Row():
|
| 110 |
|
|
|
|
| 112 |
|
| 113 |
with gr.Row():
|
| 114 |
extracted_audio_output1 = gr.Audio(label="First enroll extracted target speaker audio", type="filepath")
|
| 115 |
+
# extracted_audio_output2 = gr.Audio(label="Second enroll extracted target speaker audio", type="filepath")
|
| 116 |
|
| 117 |
convert_button = gr.Button("Extract")
|
| 118 |
convert_button.click(
|
| 119 |
fn=gradio_TSE,
|
| 120 |
+
inputs=[input_audio, enroll_audio1, audio_type, model_select],
|
| 121 |
+
outputs=[noisy_audio_output, extracted_audio_output1]
|
| 122 |
)
|
| 123 |
|
| 124 |
if __name__ == "__main__":
|