|
import gradio as gr |
|
import subprocess |
|
|
|
def rvc_infer(model, input_wav, fu): |
|
output_wav = "output.wav" |
|
command = f"rvc infer -m {model} -i {input_wav} -o {output_wav} -fu {fu}" |
|
result = subprocess.run(command, shell=True, capture_output=True, text=True) |
|
return output_wav, result.stdout |
|
|
|
with gr.Blocks() as demo: |
|
gr.Markdown("# RVC Infer") |
|
|
|
with gr.Row(): |
|
model_path = gr.Textbox(label="Model Path", placeholder="Enter model path (e.g., model.pth)") |
|
input_audio = gr.Audio(label="Input Audio", type="filepath") |
|
|
|
fu_value = gr.Slider(label="pitch", minimum=-12, maximum=12, step=1, value=0) |
|
|
|
output_audio = gr.Audio(label="Output Audio") |
|
command_output = gr.Textbox(label="Command Output") |
|
|
|
def infer(model, input_wav, fu): |
|
output_wav, result = rvc_infer(model, input_wav, fu) |
|
return output_wav, result |
|
|
|
infer_button = gr.Button("Run Inference") |
|
infer_button.click(infer, inputs=[model_path, input_audio, fu_value], outputs=[output_audio, command_output]) |
|
|
|
demo.launch() |
|
|