Simon Stolarczyk commited on
Commit
ff647b0
•
1 Parent(s): c7cb9a5

Attempt simple playback.

Browse files
.ipynb_checkpoints/README-checkpoint.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: Pop Music Transformer
3
- emoji: âš¡
4
- colorFrom: gray
5
- colorTo: green
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
@@ -10,19 +10,19 @@ pinned: false
10
 
11
  # Configuration
12
 
13
- `title`: Finish My Song
14
  Display title for the Space
15
 
16
- `emoji`: 🎶
17
  Space emoji (emoji-only character allowed)
18
 
19
- `colorFrom`: pink
20
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
 
22
  `colorTo`: grey
23
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
 
25
- `sdk`: gradio
26
  Can be either `gradio` or `streamlit`
27
 
28
  `sdk_version` : _string_
 
1
  ---
2
+ title: Music Maker Transformer
3
+ emoji: 🎶
4
+ colorFrom: pink
5
+ colorTo: gray
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
 
10
 
11
  # Configuration
12
 
13
+ `title`: _string_
14
  Display title for the Space
15
 
16
+ `emoji`: _string_
17
  Space emoji (emoji-only character allowed)
18
 
19
+ `colorFrom`: _string_
20
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
 
22
  `colorTo`: grey
23
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
 
25
+ `sdk`: _string_
26
  Can be either `gradio` or `streamlit`
27
 
28
  `sdk_version` : _string_
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -1,12 +1,18 @@
1
  import gradio as gr
2
 
3
- def process_midi(filename):
4
- return "Got it!"
 
 
 
 
 
 
5
 
6
  iface = gr.Interface(
7
  fn=process_midi,
8
  inputs="file",
9
- outputs="text"
10
  )
11
 
12
  iface.launch()
 
1
  import gradio as gr
2
 
3
+ # from musicautobot.numpy_encode import file2stream
4
+ from musicautobot.utils.setup_musescore import play_wav
5
+ from music21.midi.translate import midiFileToStream
6
+
7
+ def process_midi(midi_file):
8
+ stream = midiFileToStream(midi_file)
9
+ output_wav = play_wav(stream)
10
+ return output_wav
11
 
12
  iface = gr.Interface(
13
  fn=process_midi,
14
  inputs="file",
15
+ outputs="audio"
16
  )
17
 
18
  iface.launch()
README.md CHANGED
@@ -1,8 +1,8 @@
1
  ---
2
- title: Pop Music Transformer
3
- emoji: âš¡
4
- colorFrom: gray
5
- colorTo: green
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
@@ -10,19 +10,19 @@ pinned: false
10
 
11
  # Configuration
12
 
13
- `title`: Finish My Song
14
  Display title for the Space
15
 
16
- `emoji`: 🎶
17
  Space emoji (emoji-only character allowed)
18
 
19
- `colorFrom`: pink
20
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
 
22
  `colorTo`: grey
23
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
 
25
- `sdk`: gradio
26
  Can be either `gradio` or `streamlit`
27
 
28
  `sdk_version` : _string_
 
1
  ---
2
+ title: Music Maker Transformer
3
+ emoji: 🎶
4
+ colorFrom: pink
5
+ colorTo: gray
6
  sdk: gradio
7
  app_file: app.py
8
  pinned: false
 
10
 
11
  # Configuration
12
 
13
+ `title`: _string_
14
  Display title for the Space
15
 
16
+ `emoji`: _string_
17
  Space emoji (emoji-only character allowed)
18
 
19
+ `colorFrom`: _string_
20
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
21
 
22
  `colorTo`: grey
23
  Color for Thumbnail gradient (red, yellow, green, blue, indigo, purple, pink, gray)
24
 
25
+ `sdk`: _string_
26
  Can be either `gradio` or `streamlit`
27
 
28
  `sdk_version` : _string_
app.py CHANGED
@@ -1,12 +1,18 @@
1
  import gradio as gr
2
 
3
- def process_midi(filename):
4
- return "Got it!"
 
 
 
 
 
 
5
 
6
  iface = gr.Interface(
7
  fn=process_midi,
8
  inputs="file",
9
- outputs="text"
10
  )
11
 
12
  iface.launch()
 
1
  import gradio as gr
2
 
3
+ # from musicautobot.numpy_encode import file2stream
4
+ from musicautobot.utils.setup_musescore import play_wav
5
+ from music21.midi.translate import midiFileToStream
6
+
7
+ def process_midi(midi_file):
8
+ stream = midiFileToStream(midi_file)
9
+ output_wav = play_wav(stream)
10
+ return output_wav
11
 
12
  iface = gr.Interface(
13
  fn=process_midi,
14
  inputs="file",
15
+ outputs="audio"
16
  )
17
 
18
  iface.launch()