Kuronos commited on
Commit
e26a79d
·
1 Parent(s): 7e35b63

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -15
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
- def greet(name):
8
- """
9
- :param name: file
10
- """
11
- ret = name.name
12
- return ret
13
 
14
- demo = gr.Interface(
15
- greet,
16
- gr.File(file_types=[".mid", ".midi"]),
17
- "file",
18
- examples=['ode_to_joy.mid']
19
- )
20
-
21
- if __name__ == "__main__":
22
- demo.launch()
 
 
 
 
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)