File size: 1,140 Bytes
2a32858 46f8673 f4c4626 2a32858 f4c4626 2a32858 |
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 28 29 |
import gradio as gr
import os
from pathlib import Path
os.system("midi_ddsp_download_model_weights")
def inference(audio):
print(Path(audio.name))
print(Path(audio.name).stem)
os.system("midi_ddsp_synthesize --midi_path "+audio.name)
return Path(audio.name).stem+"/0_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."
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>"
examples=[[f'os.path.dirname(os.path.abspath(__file__))/input.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,
enable_queue=True
).launch(debug=True) |