asigalov61 commited on
Commit
8d8dd3b
·
verified ·
1 Parent(s): 54c624f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -6
app.py CHANGED
@@ -432,9 +432,11 @@ def CompareMIDIs(input_src_midi, input_trg_midi, input_sampling_resolution, inpu
432
  inp = torch.LongTensor(inp).cuda()
433
 
434
  with ctx:
435
- out = model(inp)
436
- cache = out[2]
437
- trg_embedings = cache.layer_hiddens[-1]
 
 
438
 
439
 
440
  cos_sim = pairwise.cosine_similarity([src_embedings.cpu().detach().numpy()[0].flatten()],
@@ -509,7 +511,7 @@ if __name__ == "__main__":
509
 
510
 
511
  gr.Markdown("## Upload your MIDIs or select a sample example below")
512
-
513
  gr.Markdown("## Upload source MIDI")
514
 
515
  input_src_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
@@ -517,9 +519,14 @@ if __name__ == "__main__":
517
  gr.Markdown("## Upload target MIDI")
518
 
519
  input_trg_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
 
 
 
 
 
 
520
 
521
- input_sampling_resolution = gr.Slider(40, 400, value=40, step=1, label="Sampling resolution in notes")
522
- input_sampling_overlap = gr.Slider(0, 200, value=0, step=1, label="Sampling overlap in notes")
523
 
524
  run_btn = gr.Button("compare", variant="primary")
525
 
 
432
  inp = torch.LongTensor(inp).cuda()
433
 
434
  with ctx:
435
+ with torch.no_grad():
436
+ out = model(inp)
437
+
438
+ cache = out[2]
439
+ trg_embedings = cache.layer_hiddens[-1]
440
 
441
 
442
  cos_sim = pairwise.cosine_similarity([src_embedings.cpu().detach().numpy()[0].flatten()],
 
511
 
512
 
513
  gr.Markdown("## Upload your MIDIs or select a sample example below")
514
+
515
  gr.Markdown("## Upload source MIDI")
516
 
517
  input_src_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
 
519
  gr.Markdown("## Upload target MIDI")
520
 
521
  input_trg_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
522
+
523
+ gr.Markdown("### Make sure that the MIDI has at least sampling resolution number of notes")
524
+
525
+ input_sampling_resolution = gr.Slider(40, 1000, value=40, step=1, label="Sampling resolution in notes")
526
+
527
+ gr.Markdown("### Make sure that the sampling overlap value is less than sampling resolution value")
528
 
529
+ input_sampling_overlap = gr.Slider(0, 500, value=0, step=1, label="Sampling overlap in notes")
 
530
 
531
  run_btn = gr.Button("compare", variant="primary")
532