juancopi81 commited on
Commit
a5934c8
1 Parent(s): d9489e4

Change audio type to filepath

Browse files
Files changed (2) hide show
  1. app.py +3 -3
  2. inferencemodel.py +0 -3
app.py CHANGED
@@ -64,9 +64,9 @@ def inference(yt_audio):
64
  est_ns = inference_model(audio)
65
 
66
  note_seq.sequence_proto_to_midi_file(est_ns, "./transcribed.mid")
67
- note_sequence = note_seq.midi_to_note_sequence("./transcribed.mid")
68
  synth = note_seq.midi_synth.fluidsynth
69
- array_of_floats = synth(note_sequence, sample_rate=44100)
70
  int16_data = note_seq.audio_io.float_samples_to_int16(array_of_floats)
71
  # piano_roll = create_image_from_note_sequence(note_sequence)
72
 
@@ -105,7 +105,7 @@ with demo:
105
  title = gr.Label(label="Video Title", placeholder="Title")
106
  img = gr.Image(label="Thumbnail")
107
  with gr.Row():
108
- yt_audio = gr.Audio()
109
 
110
  link.change(fn=populate_metadata, inputs=link, outputs=[img, title, yt_audio])
111
 
 
64
  est_ns = inference_model(audio)
65
 
66
  note_seq.sequence_proto_to_midi_file(est_ns, "./transcribed.mid")
67
+
68
  synth = note_seq.midi_synth.fluidsynth
69
+ array_of_floats = synth(est_ns, sample_rate=44100)
70
  int16_data = note_seq.audio_io.float_samples_to_int16(array_of_floats)
71
  # piano_roll = create_image_from_note_sequence(note_sequence)
72
 
 
105
  title = gr.Label(label="Video Title", placeholder="Title")
106
  img = gr.Image(label="Thumbnail")
107
  with gr.Row():
108
+ yt_audio = gr.Audio(type="filepath", label="First 10 seconds")
109
 
110
  link.change(fn=populate_metadata, inputs=link, outputs=[img, title, yt_audio])
111
 
inferencemodel.py CHANGED
@@ -18,9 +18,6 @@ from mt3 import preprocessors
18
  from mt3 import spectrograms
19
  from mt3 import vocabularies
20
 
21
- import nest_asyncio
22
- nest_asyncio.apply()
23
-
24
  class InferenceModel(object):
25
  """Wrapper of T5X model for music transcription."""
26
 
 
18
  from mt3 import spectrograms
19
  from mt3 import vocabularies
20
 
 
 
 
21
  class InferenceModel(object):
22
  """Wrapper of T5X model for music transcription."""
23