Update app.py
Browse files
app.py
CHANGED
@@ -510,29 +510,25 @@ if __name__ == "__main__":
|
|
510 |
|
511 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
512 |
|
513 |
-
gr.Markdown("## Select
|
514 |
|
515 |
-
|
516 |
-
|
517 |
-
|
518 |
-
|
519 |
-
input_number_prime_chords = gr.Slider(0, 512, value=0, step=8, label="Number of prime chords")
|
520 |
-
input_number_gen_chords = gr.Slider(16, 512, value=256, step=8, label="Number of chords to generate")
|
521 |
-
input_use_original_durations = gr.Checkbox(label="Use original durations", value=True)
|
522 |
-
input_match_original_pitches_counts = gr.Checkbox(label="Match original pitches counts", value=True)
|
523 |
|
524 |
-
gr.Markdown("##
|
525 |
|
526 |
-
|
527 |
-
|
528 |
|
529 |
gr.Markdown("## Model options")
|
530 |
|
531 |
-
|
532 |
-
|
533 |
-
|
534 |
|
535 |
-
run_btn = gr.Button("
|
536 |
|
537 |
gr.Markdown("## Generation results")
|
538 |
|
@@ -543,40 +539,32 @@ if __name__ == "__main__":
|
|
543 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
544 |
|
545 |
run_event = run_btn.click(Convert_Score_to_Performance, [input_midi,
|
546 |
-
|
547 |
-
|
548 |
-
|
549 |
-
|
550 |
-
|
551 |
-
|
552 |
-
|
553 |
-
input_num_memory_tokens,
|
554 |
-
input_model_temperature,
|
555 |
-
input_model_top_p,
|
556 |
-
],
|
557 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
558 |
|
559 |
gr.Examples(
|
560 |
-
[["asap_midi_score_21.mid", "
|
561 |
-
["asap_midi_score_45.mid", "
|
562 |
-
["asap_midi_score_69.mid", "
|
563 |
-
["asap_midi_score_118.mid", "
|
564 |
-
["asap_midi_score_167.mid", "
|
565 |
],
|
566 |
[input_midi,
|
567 |
-
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
input_number_gen_tokens,
|
574 |
-
input_num_memory_tokens,
|
575 |
-
input_model_temperature,
|
576 |
-
input_model_top_p,
|
577 |
],
|
578 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
|
579 |
-
|
580 |
cache_examples=True,
|
581 |
)
|
582 |
|
|
|
510 |
|
511 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
512 |
|
513 |
+
gr.Markdown("## Select conversion type")
|
514 |
|
515 |
+
input_conv_type = gr.Radio(["Durations and Velocities", "Durations", "Velocities"],
|
516 |
+
value="Durations and Velocities",
|
517 |
+
label="Conversion type"
|
518 |
+
)
|
|
|
|
|
|
|
|
|
519 |
|
520 |
+
gr.Markdown("## Conversion options")
|
521 |
|
522 |
+
input_number_prime_notes = gr.Slider(0, 512, value=0, step=8, label="Number of prime notes")
|
523 |
+
input_number_conv_notes = gr.Slider(0, 3072, value=1024, step=16, label="Number of notes to convert")
|
524 |
|
525 |
gr.Markdown("## Model options")
|
526 |
|
527 |
+
input_model_dur_top_k = gr.Slider(1, 100, value=1, step=1, label="Model sampling top k value for durations")
|
528 |
+
input_model_dur_temperature = gr.Slider(0.5, 1.5, value=1.1, step=0.05, label="Model temperature for durations")
|
529 |
+
input_model_vel_temperature = gr.Slider(0.5, 1.5, value=1.5, step=0.05, label="Model temperature for velocities")
|
530 |
|
531 |
+
run_btn = gr.Button("convert", variant="primary")
|
532 |
|
533 |
gr.Markdown("## Generation results")
|
534 |
|
|
|
539 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
540 |
|
541 |
run_event = run_btn.click(Convert_Score_to_Performance, [input_midi,
|
542 |
+
input_conv_type,
|
543 |
+
input_number_prime_notes,
|
544 |
+
input_number_conv_notes,
|
545 |
+
input_model_dur_top_k,
|
546 |
+
input_model_dur_temperature,
|
547 |
+
input_model_vel_temperature
|
548 |
+
],
|
|
|
|
|
|
|
|
|
549 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
550 |
|
551 |
gr.Examples(
|
552 |
+
[["asap_midi_score_21.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
553 |
+
["asap_midi_score_45.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
554 |
+
["asap_midi_score_69.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
555 |
+
["asap_midi_score_118.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
556 |
+
["asap_midi_score_167.mid", "Durations and Velocities", 8, 600, 1, 1.1, 1.5],
|
557 |
],
|
558 |
[input_midi,
|
559 |
+
input_conv_type,
|
560 |
+
input_number_prime_notes,
|
561 |
+
input_number_conv_notes,
|
562 |
+
input_model_dur_top_k,
|
563 |
+
input_model_dur_temperature,
|
564 |
+
input_model_vel_temperature
|
|
|
|
|
|
|
|
|
565 |
],
|
566 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
|
567 |
+
Convert_Score_to_Performance,
|
568 |
cache_examples=True,
|
569 |
)
|
570 |
|