Update app.py
Browse files
app.py
CHANGED
@@ -1,22 +1,27 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
|
|
3 |
|
4 |
os.system("midi_ddsp_download_model_weights")
|
5 |
|
|
|
|
|
|
|
|
|
|
|
|
|
6 |
|
7 |
-
|
8 |
-
"""
|
9 |
-
:param name: file
|
10 |
-
"""
|
11 |
-
ret = name.name
|
12 |
-
return ret
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
)
|
20 |
-
|
21 |
-
|
22 |
-
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
+
from pathlib import Path
|
4 |
|
5 |
os.system("midi_ddsp_download_model_weights")
|
6 |
|
7 |
+
def inference(audio):
|
8 |
+
os.system("midi_ddsp_synthesize --midi_path "+audio.name)
|
9 |
+
return Path(audio.name).stem+"/0_violin.wav"
|
10 |
+
|
11 |
+
title = "Midi-DDSP"
|
12 |
+
description = "Gradio demo for MIDI-DDSP: Detailed Control of Musical Performance via Hierarchical Modeling. Duplicated from: https://huggingface.co/spaces/akhaliq/midi-ddsp"
|
13 |
|
14 |
+
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>"
|
|
|
|
|
|
|
|
|
|
|
15 |
|
16 |
+
examples=[['input.mid']]
|
17 |
+
|
18 |
+
gr.Interface(
|
19 |
+
inference,
|
20 |
+
gr.inputs.File(type="file", label="Input"),
|
21 |
+
[gr.outputs.Audio(type="file", label="Output")],
|
22 |
+
title=title,
|
23 |
+
description=description,
|
24 |
+
article=article,
|
25 |
+
examples=examples,
|
26 |
+
enable_queue=True
|
27 |
+
).launch(debug=True)
|