import gradio as gr import os from pathlib import Path os.system("midi_ddsp_download_model_weights") def inference(audio): os.system("midi_ddsp_synthesize --midi_path "+audio.name) return f'./{Path(audio.name).stem}/mix.wav' title = "MIDI-DDSP" description = "Gradio demo for MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling. To use it, simply upload your midi file, or click one of the examples to load them. Read more at the links below. Adapted from huggingface space by akhaliq/midi-ddsp (https://huggingface.co/spaces/akhaliq/midi-ddsp)." article = "
MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling | Github Repo
" examples=[['ode_to_joy.mid']] gr.Interface( inference, gr.inputs.File(type="file", label="Input"), [gr.outputs.Audio(type="file", label="Output")], title=title, description=description, article=article, examples=examples ).launch(debug=True, enable_queue=True)