Update webui.py
Browse files
webui.py
CHANGED
@@ -27,7 +27,7 @@ def audio_model_inference(files, output_folder, model_path, denoise, margin, chu
|
|
27 |
|
28 |
# 检查命令是否成功执行
|
29 |
if result.returncode != 0:
|
30 |
-
return f"
|
31 |
|
32 |
# 读取输出文件
|
33 |
vocals_file = f"{os.path.splitext(os.path.basename(files[0]))[0]}_vocals.wav"
|
@@ -37,7 +37,7 @@ def audio_model_inference(files, output_folder, model_path, denoise, margin, chu
|
|
37 |
|
38 |
# 确保文件存在
|
39 |
if not os.path.exists(vocals_path) or not os.path.exists(no_vocals_path):
|
40 |
-
return "
|
41 |
|
42 |
# 读取音频文件
|
43 |
vocals_audio = open(vocals_path, 'rb').read()
|
@@ -47,26 +47,26 @@ def audio_model_inference(files, output_folder, model_path, denoise, margin, chu
|
|
47 |
|
48 |
# Gradio 界面组件
|
49 |
inputs = [
|
50 |
-
gr.
|
51 |
-
gr.
|
52 |
-
gr.
|
53 |
-
gr.
|
54 |
-
gr.
|
55 |
-
gr.
|
56 |
-
gr.
|
57 |
-
gr.
|
58 |
-
gr.
|
59 |
]
|
60 |
|
61 |
-
outputs = [gr.outputs.Audio(label="
|
62 |
|
63 |
# 创建界面
|
64 |
iface = gr.Interface(
|
65 |
fn=audio_model_inference,
|
66 |
inputs=inputs,
|
67 |
outputs=outputs,
|
68 |
-
title="
|
69 |
-
description="
|
70 |
)
|
71 |
|
72 |
iface.launch()
|
|
|
27 |
|
28 |
# 检查命令是否成功执行
|
29 |
if result.returncode != 0:
|
30 |
+
return f"错误:{result.stderr}"
|
31 |
|
32 |
# 读取输出文件
|
33 |
vocals_file = f"{os.path.splitext(os.path.basename(files[0]))[0]}_vocals.wav"
|
|
|
37 |
|
38 |
# 确保文件存在
|
39 |
if not os.path.exists(vocals_path) or not os.path.exists(no_vocals_path):
|
40 |
+
return "错误:输出文件未找到。"
|
41 |
|
42 |
# 读取音频文件
|
43 |
vocals_audio = open(vocals_path, 'rb').read()
|
|
|
47 |
|
48 |
# Gradio 界面组件
|
49 |
inputs = [
|
50 |
+
gr.types.File(label="源音频文件", type='file', file_count='multiple'),
|
51 |
+
gr.types.Textbox(label="输出文件夹", default="./"),
|
52 |
+
gr.types.Textbox(label="模型路径", default="./models/MDX_Net_Models/UVR-MDX-NET-Inst_HQ_3.onnx"),
|
53 |
+
gr.types.Checkbox(label="启用降噪", default=False),
|
54 |
+
gr.types.Number(label="边距", default=0.1),
|
55 |
+
gr.types.Number(label="块大小", default=1024),
|
56 |
+
gr.types.Number(label="FFT大小", default=2048),
|
57 |
+
gr.types.Number(label="时间维度", default=512),
|
58 |
+
gr.types.Number(label="频率维度", default=64)
|
59 |
]
|
60 |
|
61 |
+
outputs = [gr.outputs.Audio(label="人声"), gr.outputs.Audio(label="无人声")]
|
62 |
|
63 |
# 创建界面
|
64 |
iface = gr.Interface(
|
65 |
fn=audio_model_inference,
|
66 |
inputs=inputs,
|
67 |
outputs=outputs,
|
68 |
+
title="音频分离模型",
|
69 |
+
description="上传音频文件并配置参数,使用音频分离模型处理它们。"
|
70 |
)
|
71 |
|
72 |
iface.launch()
|