Update app.py
Browse files
app.py
CHANGED
@@ -151,6 +151,7 @@ def load_midi(midi_file):
|
|
151 |
|
152 |
@spaces.GPU
|
153 |
def Convert_Score_to_Performance(input_midi,
|
|
|
154 |
input_conv_type,
|
155 |
input_number_prime_notes,
|
156 |
input_number_conv_notes,
|
@@ -173,6 +174,7 @@ def Convert_Score_to_Performance(input_midi,
|
|
173 |
print('Requested settings:')
|
174 |
print('=' * 70)
|
175 |
print('Input MIDI file name:', fn)
|
|
|
176 |
print('Conversion type:', input_conv_type)
|
177 |
print('Number of prime notes:', input_number_prime_notes)
|
178 |
print('Number of notes to convert:', input_number_conv_notes)
|
@@ -388,7 +390,14 @@ if __name__ == "__main__":
|
|
388 |
gr.Markdown("### PLEASE NOTE that the score MIDI MUST HAVE at least 300 notes for this demo to work")
|
389 |
|
390 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
391 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
gr.Markdown("## Select conversion type")
|
393 |
|
394 |
input_conv_type = gr.Radio(["Durations and Velocities", "Durations", "Velocities"],
|
@@ -418,6 +427,7 @@ if __name__ == "__main__":
|
|
418 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
419 |
|
420 |
run_event = run_btn.click(Convert_Score_to_Performance, [input_midi,
|
|
|
421 |
input_conv_type,
|
422 |
input_number_prime_notes,
|
423 |
input_number_conv_notes,
|
@@ -428,13 +438,14 @@ if __name__ == "__main__":
|
|
428 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
429 |
|
430 |
gr.Examples(
|
431 |
-
[["asap_midi_score_21.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
432 |
-
["asap_midi_score_45.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
433 |
-
["asap_midi_score_69.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
434 |
-
["asap_midi_score_118.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
435 |
-
["asap_midi_score_167.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
436 |
],
|
437 |
[input_midi,
|
|
|
438 |
input_conv_type,
|
439 |
input_number_prime_notes,
|
440 |
input_number_conv_notes,
|
|
|
151 |
|
152 |
@spaces.GPU
|
153 |
def Convert_Score_to_Performance(input_midi,
|
154 |
+
input_midi_type,
|
155 |
input_conv_type,
|
156 |
input_number_prime_notes,
|
157 |
input_number_conv_notes,
|
|
|
174 |
print('Requested settings:')
|
175 |
print('=' * 70)
|
176 |
print('Input MIDI file name:', fn)
|
177 |
+
print('Input MIDI type':, input_midi_type)
|
178 |
print('Conversion type:', input_conv_type)
|
179 |
print('Number of prime notes:', input_number_prime_notes)
|
180 |
print('Number of notes to convert:', input_number_conv_notes)
|
|
|
390 |
gr.Markdown("### PLEASE NOTE that the score MIDI MUST HAVE at least 300 notes for this demo to work")
|
391 |
|
392 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
393 |
+
|
394 |
+
gr.Markdown("## Select MIDI type")
|
395 |
+
|
396 |
+
input_midi_type = gr.Radio(["Score", "Performance", "Custom"],
|
397 |
+
value="Score",
|
398 |
+
label="Input MIDI type",
|
399 |
+
info="Select 'Custom' option to enable model top_k and temperature settings below"
|
400 |
+
)
|
401 |
gr.Markdown("## Select conversion type")
|
402 |
|
403 |
input_conv_type = gr.Radio(["Durations and Velocities", "Durations", "Velocities"],
|
|
|
427 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
428 |
|
429 |
run_event = run_btn.click(Convert_Score_to_Performance, [input_midi,
|
430 |
+
input_midi_type,
|
431 |
input_conv_type,
|
432 |
input_number_prime_notes,
|
433 |
input_number_conv_notes,
|
|
|
438 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
439 |
|
440 |
gr.Examples(
|
441 |
+
[["asap_midi_score_21.mid", "Score", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
442 |
+
["asap_midi_score_45.mid", "Score", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
443 |
+
["asap_midi_score_69.mid", "Score", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
444 |
+
["asap_midi_score_118.mid", "Score", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
445 |
+
["asap_midi_score_167.mid", "Score", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
446 |
],
|
447 |
[input_midi,
|
448 |
+
input_midi_type,
|
449 |
input_conv_type,
|
450 |
input_number_prime_notes,
|
451 |
input_number_conv_notes,
|