Spaces:
Build error
Build error
Commit
·
7c17274
1
Parent(s):
b37a7e3
Change inference model
Browse files
app.py
CHANGED
@@ -52,9 +52,8 @@ def populate_metadata(link):
|
|
52 |
audio = get_audio(link)
|
53 |
return yt.thumbnail_url, yt.title, audio
|
54 |
|
55 |
-
def inference(
|
56 |
-
|
57 |
-
with open(inputs[0], "rb") as fd:
|
58 |
contents = fd.read()
|
59 |
|
60 |
audio = upload_audio(contents,sample_rate=16000)
|
@@ -68,7 +67,7 @@ def inference(inputs):
|
|
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"
|
72 |
|
73 |
title = "Transcribe music from YouTube videos using Transformers."
|
74 |
description = """
|
@@ -110,13 +109,12 @@ with demo:
|
|
110 |
with gr.Row():
|
111 |
btn = gr.Button("Transcribe music")
|
112 |
|
113 |
-
|
|
|
|
|
114 |
|
115 |
-
btn.click(inference,
|
116 |
-
|
117 |
-
yt_audio
|
118 |
-
],
|
119 |
-
outputs=audio_file)
|
120 |
|
121 |
gr.Markdown(article)
|
122 |
|
|
|
52 |
audio = get_audio(link)
|
53 |
return yt.thumbnail_url, yt.title, audio
|
54 |
|
55 |
+
def inference(yt_audio):
|
56 |
+
with open(yt_audio, "rb") as fd:
|
|
|
57 |
contents = fd.read()
|
58 |
|
59 |
audio = upload_audio(contents,sample_rate=16000)
|
|
|
67 |
int16_data = note_seq.audio_io.float_samples_to_int16(array_of_floats)
|
68 |
# piano_roll = create_image_from_note_sequence(note_sequence)
|
69 |
|
70 |
+
return "./transcribed.mid", (SAMPLE_RATE, int16_data)
|
71 |
|
72 |
title = "Transcribe music from YouTube videos using Transformers."
|
73 |
description = """
|
|
|
109 |
with gr.Row():
|
110 |
btn = gr.Button("Transcribe music")
|
111 |
|
112 |
+
with gr.Row():
|
113 |
+
midi_file = gr.File()
|
114 |
+
midi_audio = gr.Audio()
|
115 |
|
116 |
+
btn.click(inference(yt_audio),
|
117 |
+
outputs=[midi_file, midi_audio])
|
|
|
|
|
|
|
118 |
|
119 |
gr.Markdown(article)
|
120 |
|