asigalov61 commited on
Commit
9242953
·
verified ·
1 Parent(s): 6279008

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -21
app.py CHANGED
@@ -237,7 +237,7 @@ def read_MIDI(input_midi):
237
 
238
 
239
  @spaces.GPU
240
- def InpaintPitches(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,10 +460,10 @@ if __name__ == "__main__":
460
 
461
  input_trg_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
462
 
463
- input_num_of_notes = gr.Slider(8, 2048, value=128, step=8, label="Number of composition notes to inpaint")
464
- input_patch_number = gr.Slider(0, 127, value=0, step=1, label="Composition MIDI patch to inpaint")
465
 
466
- run_btn = gr.Button("inpaint", variant="primary")
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(InpaintPitches, [input_midi, input_num_of_notes, input_patch_number],
477
- [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
478
 
479
  gr.Examples(
480
- [["Giant-Music-Transformer-Piano-Seed-1.mid", 128, 0],
481
- ["Giant-Music-Transformer-Piano-Seed-2.mid", 128, 0],
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
- [input_midi, input_num_of_notes, input_patch_number],
494
- [output_midi_title, output_midi_summary, output_midi, output_audio, output_plot],
495
- InpaintPitches,
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