asigalov61
commited on
Commit
•
9a50d02
1
Parent(s):
d7ec460
Update app.py
Browse files
app.py
CHANGED
@@ -142,12 +142,19 @@ def ClassifyMIDI(input_midi):
|
|
142 |
print('=' * 70)
|
143 |
|
144 |
#==============================================================
|
|
|
|
|
145 |
|
146 |
print('Composition has', notes_counter, 'notes')
|
147 |
print('=' * 70)
|
148 |
-
print('Composition was split into' , len(input_data), 'chunks
|
149 |
print('Number of notes in all composition chunks:', len(input_data) * 340)
|
150 |
|
|
|
|
|
|
|
|
|
|
|
151 |
number_of_batches = 100 # @param {type:"slider", min:1, max:100, step:1}
|
152 |
|
153 |
# @markdown NOTE: You can increase the number of batches on high-ram GPUs for better classification
|
@@ -288,8 +295,11 @@ if __name__ == "__main__":
|
|
288 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Advanced MIDI Classifier</h1>")
|
289 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Detailed MIDI classification with transformers</h1>")
|
290 |
gr.Markdown(
|
291 |
-
"![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Advanced-MIDI-Classifier&style=flat)\n\n"
|
292 |
-
|
|
|
|
|
|
|
293 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
294 |
|
295 |
run_btn = gr.Button("classify", variant="primary")
|
@@ -297,7 +307,7 @@ if __name__ == "__main__":
|
|
297 |
gr.Markdown("## Classification results")
|
298 |
|
299 |
output_midi_title = gr.Textbox(label="Output MIDI title")
|
300 |
-
output_midi_summary = gr.Textbox(label="
|
301 |
output_audio = gr.Audio(label="Output MIDI audio", format="wav", elem_id="midi_audio")
|
302 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
303 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
|
|
142 |
print('=' * 70)
|
143 |
|
144 |
#==============================================================
|
145 |
+
|
146 |
+
classification_summary_string = '=' * 70
|
147 |
|
148 |
print('Composition has', notes_counter, 'notes')
|
149 |
print('=' * 70)
|
150 |
+
print('Composition was split into' , len(input_data), 'chunks of 340 notes each with 170 notes overlap')
|
151 |
print('Number of notes in all composition chunks:', len(input_data) * 340)
|
152 |
|
153 |
+
classification_summary_string += 'Composition has ' + str(notes_counter) + ' notes'
|
154 |
+
classification_summary_string += '=' * 70
|
155 |
+
classification_summary_string += 'Composition was split into ' + str(len(input_data)) + ' chunks of 340 notes each with 170 notes overlap'
|
156 |
+
classification_summary_string += 'Number of notes in all composition chunks: ' + str(len(input_data) * 340)
|
157 |
+
|
158 |
number_of_batches = 100 # @param {type:"slider", min:1, max:100, step:1}
|
159 |
|
160 |
# @markdown NOTE: You can increase the number of batches on high-ram GPUs for better classification
|
|
|
295 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Advanced MIDI Classifier</h1>")
|
296 |
gr.Markdown("<h1 style='text-align: center; margin-bottom: 1rem'>Detailed MIDI classification with transformers</h1>")
|
297 |
gr.Markdown(
|
298 |
+
"![Visitors](https://api.visitorbadge.io/api/visitors?path=asigalov61.Advanced-MIDI-Classifier&style=flat)\n\n"
|
299 |
+
"This is a demo for TMIDIX Python module from tegridy-tools\n\n"
|
300 |
+
"Check out [tegridy-tools](https://github.com/asigalov61/tegridy-tools) on GitHub!\n\n"
|
301 |
+
)
|
302 |
+
|
303 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
304 |
|
305 |
run_btn = gr.Button("classify", variant="primary")
|
|
|
307 |
gr.Markdown("## Classification results")
|
308 |
|
309 |
output_midi_title = gr.Textbox(label="Output MIDI title")
|
310 |
+
output_midi_summary = gr.Textbox(label="MIDI classification summary")
|
311 |
output_audio = gr.Audio(label="Output MIDI audio", format="wav", elem_id="midi_audio")
|
312 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
313 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|