Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -237,7 +237,7 @@ def read_MIDI(input_midi):
|
|
237 |
|
238 |
|
239 |
@spaces.GPU
|
240 |
-
def
|
241 |
print('=' * 70)
|
242 |
print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
243 |
start_time = reqtime.time()
|
@@ -460,10 +460,10 @@ if __name__ == "__main__":
|
|
460 |
|
461 |
input_trg_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
462 |
|
463 |
-
|
464 |
-
|
465 |
|
466 |
-
run_btn = gr.Button("
|
467 |
|
468 |
gr.Markdown("## Inpainting results")
|
469 |
|
@@ -473,26 +473,16 @@ if __name__ == "__main__":
|
|
473 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
474 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
475 |
|
476 |
-
run_event = run_btn.click(
|
477 |
-
[
|
478 |
|
479 |
gr.Examples(
|
480 |
-
[
|
481 |
-
["
|
482 |
-
["Giant-Music-Transformer-Piano-Seed-3.mid", 128, 0],
|
483 |
-
["Giant-Music-Transformer-Piano-Seed-4.mid", 128, 0],
|
484 |
-
["Giant-Music-Transformer-Piano-Seed-5.mid", 128, 2],
|
485 |
-
["Giant-Music-Transformer-Piano-Seed-6.mid", 128, 0],
|
486 |
-
["Giant-Music-Transformer-MI-Seed-1.mid", 128, 71],
|
487 |
-
["Giant-Music-Transformer-MI-Seed-2.mid", 128, 40],
|
488 |
-
["Giant-Music-Transformer-MI-Seed-3.mid", 128, 40],
|
489 |
-
["Giant-Music-Transformer-MI-Seed-4.mid", 128, 40],
|
490 |
-
["Giant-Music-Transformer-MI-Seed-5.mid", 128, 40],
|
491 |
-
["Giant-Music-Transformer-MI-Seed-6.mid", 128, 0]
|
492 |
],
|
493 |
-
[
|
494 |
-
[
|
495 |
-
|
496 |
cache_examples=True,
|
497 |
)
|
498 |
|
|
|
237 |
|
238 |
|
239 |
@spaces.GPU
|
240 |
+
def CompareMIDIs(input_midi, input_num_of_notes, input_patch_number):
|
241 |
print('=' * 70)
|
242 |
print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
243 |
start_time = reqtime.time()
|
|
|
460 |
|
461 |
input_trg_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
462 |
|
463 |
+
input_sampling_resolution = gr.Slider(40, 400, value=40, step=1, label="Sampling resolution in notes")
|
464 |
+
input_sampling_overlap = gr.Slider(0, 200, value=0, step=1, label="Sampling overlap in notes")
|
465 |
|
466 |
+
run_btn = gr.Button("compare", variant="primary")
|
467 |
|
468 |
gr.Markdown("## Inpainting results")
|
469 |
|
|
|
473 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
474 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
475 |
|
476 |
+
run_event = run_btn.click(CompareMIDIs, [input_src_midi, input_trg_midi, input_sampling_resolution, input_sampling_overlap],
|
477 |
+
[output_audio, output_plot])
|
478 |
|
479 |
gr.Examples(
|
480 |
+
[
|
481 |
+
["Honesty.kar", "Hotel California.mid", 128, 0]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
482 |
],
|
483 |
+
[input_src_midi, input_trg_midi, input_sampling_resolution, input_sampling_overlap],
|
484 |
+
[output_audio, output_plot],
|
485 |
+
CompareMIDIs,
|
486 |
cache_examples=True,
|
487 |
)
|
488 |
|