File size: 1,010 Bytes
75cf7e3 7adeec2 e26a79d 75cf7e3 bbebae2 e26a79d 59e0206 bbebae2 e26a79d 75cf7e3 a5d9d1d e26a79d a5d9d1d 380dd6b e26a79d |
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 |
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 Path(audio.name).stem+"/0_violin.wav"
title = "Midi-DDSP"
description = "Gradio demo for MIDI-DDSP: \n[NOTICE]: expect instrument {violin} in midi file! You may achieve this by selecting violin in daw then export the midi. \n - Reworked to fix runtime error, based on: https://huggingface.co/spaces/akhaliq/midi-ddsp"
article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2112.09312' target='_blank'>MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling</a> | <a href='https://github.com/magenta/midi-ddsp' target='_blank'>Github Repo</a></p>"
example=['ode_to_joy.mid']
gr.Interface(
inference,
gr.File(file_types=['.mid','.midi']),
"file",
title=title,
description=description,
article=article,
enable_queue=True
).launch(debug=True) |