Blane187 commited on
Commit
c17e167
1 Parent(s): 0c1b49d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -1,29 +1,33 @@
1
  import gradio as gr
2
  import subprocess
3
 
4
- def rvc_infer(model, input_wav, fu):
5
  output_wav = "output.wav" # Define a path for the output file
6
- command = f"rvc infer -m {model} -i {input_wav} -o {output_wav} -fu {fu}"
7
  result = subprocess.run(command, shell=True, capture_output=True, text=True)
8
  return output_wav, result.stdout
9
 
10
  with gr.Blocks() as demo:
11
- gr.Markdown("# RVC Infer")
12
 
13
  with gr.Row():
14
- model_path = gr.Textbox(label="Model Path", placeholder="Enter model path (e.g., model.pth)")
 
15
  input_audio = gr.Audio(label="Input Audio", type="filepath")
 
 
 
 
16
 
17
- fu_value = gr.Slider(label="pitch", minimum=-12, maximum=12, step=1, value=0)
18
 
19
  output_audio = gr.Audio(label="Output Audio")
20
  command_output = gr.Textbox(label="Command Output")
21
 
22
- def infer(model, input_wav, fu):
23
- output_wav, result = rvc_infer(model, input_wav, fu)
24
  return output_wav, result
25
 
26
  infer_button = gr.Button("Run Inference")
27
- infer_button.click(infer, inputs=[model_path, input_audio, fu_value], outputs=[output_audio, command_output])
28
 
29
  demo.launch()
 
1
  import gradio as gr
2
  import subprocess
3
 
4
+ def rvc_infer(model, input_wav, fu, fmethod):
5
  output_wav = "output.wav" # Define a path for the output file
6
+ command = f"rvc infer -m {model} -i {input_wav} -o {output_wav} -fu {fu} -fm {fmethod}"
7
  result = subprocess.run(command, shell=True, capture_output=True, text=True)
8
  return output_wav, result.stdout
9
 
10
  with gr.Blocks() as demo:
11
+ gr.Markdown("# RVC `pip` Demo")
12
 
13
  with gr.Row():
14
+ model_path = gr.File(label="Model file")
15
+ with gr.Row():
16
  input_audio = gr.Audio(label="Input Audio", type="filepath")
17
+ with gr.Row():
18
+ fu_value = gr.Slider(label="pitch", minimum=-12, maximum=12, step=1, value=0)
19
+ with gr.Row():
20
+ f0_value = gr.Dropdown(choise=["pm", "crepe", "rmvpe", label="F0 method", value="rmvpe")
21
 
 
22
 
23
  output_audio = gr.Audio(label="Output Audio")
24
  command_output = gr.Textbox(label="Command Output")
25
 
26
+ def infer(model, input_wav, fu, fmethod,fmethod):
27
+ output_wav, result = rvc_infer(model, input_wav, fu,fmethod)
28
  return output_wav, result
29
 
30
  infer_button = gr.Button("Run Inference")
31
+ infer_button.click(infer, inputs=[model_path, input_audio, fu_value,f0_value], outputs=[output_audio, command_output])
32
 
33
  demo.launch()