-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebui.py
27 lines (24 loc) · 1.56 KB
/
webui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
from infer import wav2svp
def inference(input, bpm, extract_pitch, extract_tension, extract_breathiness):
model_path = "weights/model_steps_64000_simplified.ckpt"
return wav2svp(input, model_path, bpm, extract_pitch, extract_tension, extract_breathiness)
def webui():
with gr.Blocks() as webui:
gr.Markdown('''<div align="center"><font size=6><b>wav2svp - Waveform to Synthesizer V Project</b></font></div>''')
gr.Markdown("Upload an audio file and download the svp file with midi and selected datas.")
with gr.Row():
with gr.Column():
input = gr.File(label="Input Audio File", type="filepath")
bpm = gr.Number(label='BPM Value', minimum=20, maximum=200, value=120, step=0.01, interactive=True)
extract_pitch = gr.Checkbox(label="Extract Pitch Data", value=True)
extract_tension = gr.Checkbox(label="Extract Tension Data (Experimental)", value=False)
extract_breathiness = gr.Checkbox(label="Extract Breathiness Data (Experimental)", value=False)
run = gr.Button(value="Generate svp File", variant="primary")
with gr.Column():
output_svp = gr.File(label="Output svp File", type="filepath", interactive=False)
output_midi = gr.File(label="Output midi File", type="filepath", interactive=False)
run.click(inference, [input, bpm, extract_pitch, extract_tension, extract_breathiness], [output_svp, output_midi])
webui.launch(inbrowser=True)
if __name__ == '__main__':
webui()