Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -24,20 +24,12 @@ def midi_ddsp_synth(instrument, midi_file):
|
|
24 |
if instrument not in INST_NAME_LIST:
|
25 |
raise ValueError('Error: not an available instrument type')
|
26 |
instrument_id = INST_NAME_TO_ID_DICT[instrument]
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
print(os.path.join('./', os.path.basename(midi_file.name).replace('.mid', '.wav')))
|
31 |
-
print(midi_file.name[:-4]+'.wav')
|
32 |
-
print(os.path.abspath(os.path.join('./', os.path.basename(midi_file.name).replace('.mid', '.wav'))))
|
33 |
-
return os.path.join('./', os.path.basename(midi_file.name).replace('.mid', '.wav'))
|
34 |
-
|
35 |
-
# def inference(audio):
|
36 |
-
# os.system("midi_ddsp_synthesize --midi_path "+audio.name)
|
37 |
-
# return Path(audio.name).stem+"/0_violin.wav"
|
38 |
|
39 |
-
|
40 |
-
|
41 |
|
42 |
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>"
|
43 |
|
@@ -45,9 +37,11 @@ gr.Interface(
|
|
45 |
fn = midi_ddsp_synth,
|
46 |
inputs = [
|
47 |
gr.inputs.Textbox(
|
48 |
-
lines=1, placeholder=None, default='', label='instrument
|
49 |
gr.File(type="file", label="Input")
|
50 |
],
|
51 |
outputs = "audio",
|
|
|
|
|
52 |
article = article,
|
53 |
).launch(debug=True)
|
|
|
24 |
if instrument not in INST_NAME_LIST:
|
25 |
raise ValueError('Error: not an available instrument type')
|
26 |
instrument_id = INST_NAME_TO_ID_DICT[instrument]
|
27 |
+
_ = synthesize_mono_midi(synthesis_generator, expression_generator, midi_file.name,
|
28 |
+
instrument_id, output_dir='/tmp', pitch_offset=0, speed_rate=1)
|
29 |
+
return os.path.join('/tmp', os.path.basename(midi_file.name).replace('.mid', '.wav'))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
+
title = "Midi-DDSP"
|
32 |
+
description = "Unofficial Gradio demo for MIDI-DDSP"
|
33 |
|
34 |
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>"
|
35 |
|
|
|
37 |
fn = midi_ddsp_synth,
|
38 |
inputs = [
|
39 |
gr.inputs.Textbox(
|
40 |
+
lines=1, placeholder=None, default='', label='instrument'),
|
41 |
gr.File(type="file", label="Input")
|
42 |
],
|
43 |
outputs = "audio",
|
44 |
+
title = title,
|
45 |
+
description = description,
|
46 |
article = article,
|
47 |
).launch(debug=True)
|