Violin_midi_pro / app.py
shethjenil's picture
Update app.py
38cf553 verified
raw
history blame contribute delete
725 Bytes
import gradio as gr
from unidecode import unidecode
from musc.model import PretrainedModel
Model = PretrainedModel(instrument='violin').to("cpu")
def transcribe_and_generate_midi(wav_file_path, model=Model, batch_size=32, postprocessing='spotify'):
model.transcribe(wav_file_path, batch_size=batch_size, postprocessing=postprocessing).write("output.mid")
return "output.mid"
gr.Interface(
fn=transcribe_and_generate_midi,
inputs=gr.Audio(label="Upload your WAV file",type="filepath"),
outputs=gr.File(label="Download MIDI file"),
live=False,
title="Violin to MIDI Converter",
description="Upload a WAV file of a violin performance, and it will be transcribed into MIDI format."
).launch()