next-playground commited on
Commit
9d84835
·
verified ·
1 Parent(s): 8d9365f

Update webui.py

Browse files
Files changed (1) hide show
  1. webui.py +14 -14
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"Error: {result.stderr}"
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 "Error: Output files not found."
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.inputs.File(label="Source Audio Files", type='file', file_count='multiple'),
51
- gr.inputs.Textbox(label="Output Folder", default="output/"),
52
- gr.inputs.Textbox(label="Model Path", default="model.onnx"),
53
- gr.inputs.Checkbox(label="Enable Denoising", default=False),
54
- gr.inputs.Number(label="Margin", default=0.1),
55
- gr.inputs.Number(label="Chunk Size", default=1024),
56
- gr.inputs.Number(label="FFT Size", default=2048),
57
- gr.inputs.Number(label="Time Dimension", default=512),
58
- gr.inputs.Number(label="Frequency Dimension", default=64)
59
  ]
60
 
61
- outputs = [gr.outputs.Audio(label="Vocals"), gr.outputs.Audio(label="No Vocals")]
62
 
63
  # 创建界面
64
  iface = gr.Interface(
65
  fn=audio_model_inference,
66
  inputs=inputs,
67
  outputs=outputs,
68
- title="Audio Separation Model",
69
- description="Upload audio files and configure parameters to process them using the audio separation model."
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()