BilalSardar commited on
Commit
a341184
1 Parent(s): f0098ec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -7
app.py CHANGED
@@ -23,7 +23,14 @@ import pretty_midi
23
  import librosa.display
24
  import matplotlib.pyplot as plt
25
 
26
- midtoaud=gr.Interface.load(name="spaces/kboaten/MIDI-Audio-Extension")
 
 
 
 
 
 
 
27
  print('Loading the Karaoke model. Please wait...')
28
  data = TMIDI.Tegridy_Any_Pickle_File_Loader('Karaoke-English-Full')
29
 
@@ -171,14 +178,19 @@ def TextToMusic(lyrics,notes,rand):
171
  plt.savefig('my_plot.png')
172
  print('Synthesizing the last output MIDI. Please stand-by... ')
173
 
174
- url=midtoaud("deep-muse-Output-MIDI.mid",int(notes),fn_index=0)
175
- save_as = "file.wav"
176
 
177
- data1 = urllib.request.urlopen(url)
178
 
179
- f = open(save_as,'wb')
180
- f.write(data1.read())
181
- f.close()
 
 
 
 
 
182
  return 'file.wav','my_plot.png'
183
 
184
  demo = gr.Interface(
 
23
  import librosa.display
24
  import matplotlib.pyplot as plt
25
 
26
+
27
+ import mido
28
+ from midi2audio import FluidSynth
29
+
30
+
31
+
32
+
33
+ #midtoaud=gr.Interface.load(name="spaces/kboaten/MIDI-Audio-Extension")
34
  print('Loading the Karaoke model. Please wait...')
35
  data = TMIDI.Tegridy_Any_Pickle_File_Loader('Karaoke-English-Full')
36
 
 
178
  plt.savefig('my_plot.png')
179
  print('Synthesizing the last output MIDI. Please stand-by... ')
180
 
181
+ # url=midtoaud("deep-muse-Output-MIDI.mid",int(notes),fn_index=0)
182
+ # save_as = "file.wav"
183
 
184
+ # data1 = urllib.request.urlopen(url)
185
 
186
+ # f = open(save_as,'wb')
187
+ # f.write(data1.read())
188
+ # f.close()
189
+
190
+ mid = mido.MidiFile("deep-muse-Output-MIDI.mid")
191
+
192
+ fs = FluidSynth()
193
+ fs.midi_to_audio("deep-muse-Output-MIDI.mid", 'file.wav')
194
  return 'file.wav','my_plot.png'
195
 
196
  demo = gr.Interface(