import gradio as gr import subprocess import os os.system("rvc init") os.system("rvc env create") os.system("rvc dlmodel") def rvc_infer(model, input_wav, fu, fmethod): output_wav = "output.wav" # Define a path for the output file command = f"rvc infer -m {model} -i {input_wav} -o {output_wav} -fu {fu} -fm {fmethod}" result = subprocess.run(command, shell=True, capture_output=True, text=True) return output_wav, result.stdout with gr.Blocks() as demo: gr.Markdown("# RVC `pip` Demo") with gr.Row(): model_path = gr.File(label="Model file") with gr.Row(): input_audio = gr.Audio(label="Input Audio", type="filepath") with gr.Row(): fu_value = gr.Slider(label="pitch", minimum=-12, maximum=12, step=1, value=0) with gr.Row(): f0_value = gr.Dropdown(choise=["pm", "crepe", "rmvpe", label="F0 method", value="rmvpe") output_audio = gr.Audio(label="Output Audio") command_output = gr.Textbox(label="Command Output") def infer(model, input_wav, fu, fmethod,fmethod): output_wav, result = rvc_infer(model, input_wav, fu,fmethod) return output_wav, result infer_button = gr.Button("Run Inference") infer_button.click(infer, inputs=[model_path, input_audio, fu_value,f0_value], outputs=[output_audio, command_output]) demo.launch()