Spaces:
Build error
Build error
juancopi81
commited on
Commit
·
b37a7e3
1
Parent(s):
f8401ac
Change way to detect audio file
Browse files
app.py
CHANGED
@@ -53,8 +53,8 @@ def populate_metadata(link):
|
|
53 |
return yt.thumbnail_url, yt.title, audio
|
54 |
|
55 |
def inference(inputs):
|
56 |
-
|
57 |
-
with open(
|
58 |
contents = fd.read()
|
59 |
|
60 |
audio = upload_audio(contents,sample_rate=16000)
|
@@ -62,10 +62,10 @@ def inference(inputs):
|
|
62 |
est_ns = inference_model(audio)
|
63 |
|
64 |
note_seq.sequence_proto_to_midi_file(est_ns, "./transcribed.mid")
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
# piano_roll = create_image_from_note_sequence(note_sequence)
|
70 |
|
71 |
return "./transcribed.mid"
|
|
|
53 |
return yt.thumbnail_url, yt.title, audio
|
54 |
|
55 |
def inference(inputs):
|
56 |
+
print(inputs)
|
57 |
+
with open(inputs[0], "rb") as fd:
|
58 |
contents = fd.read()
|
59 |
|
60 |
audio = upload_audio(contents,sample_rate=16000)
|
|
|
62 |
est_ns = inference_model(audio)
|
63 |
|
64 |
note_seq.sequence_proto_to_midi_file(est_ns, "./transcribed.mid")
|
65 |
+
note_sequence = note_seq.midi_to_note_sequence("./transcribed.mid")
|
66 |
+
synth = note_seq.midi_synth.fluidsynth
|
67 |
+
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
68 |
+
int16_data = note_seq.audio_io.float_samples_to_int16(array_of_floats)
|
69 |
# piano_roll = create_image_from_note_sequence(note_sequence)
|
70 |
|
71 |
return "./transcribed.mid"
|