asigalov61 commited on
Commit
ee32103
1 Parent(s): 6a7c2e0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -24,7 +24,7 @@ in_space = os.getenv("SYSTEM") == "spaces"
24
 
25
  #==========================================================================================================
26
 
27
- def match_midi(midi, progress=gr.Progress()):
28
 
29
  print('=' * 70)
30
  print('Loading MIDI file...')
@@ -149,7 +149,7 @@ def match_midi(midi, progress=gr.Progress()):
149
 
150
  #@markdown Match ratio control option
151
 
152
- maximum_match_ratio_to_search_for = 1 #@param {type:"slider", min:0, max:1, step:0.01}
153
 
154
  #@markdown MIDI pitches search options
155
 
@@ -402,6 +402,8 @@ if __name__ == "__main__":
402
  "(https://colab.research.google.com/github/asigalov61/Los-Angeles-MIDI-Dataset/blob/main/Los_Angeles_MIDI_Dataset_Search_and_Explore.ipynb)"
403
  " for faster execution"
404
  )
 
 
405
 
406
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"], type="binary")
407
 
@@ -412,7 +414,7 @@ if __name__ == "__main__":
412
  output_midi = gr.File(label="Output MIDI match sample MIDI", file_types=[".mid"])
413
  output_midi_seq = gr.Textbox(label="Output MIDI match metadata")
414
 
415
- run_event = input_midi.upload(match_midi, [input_midi],
416
  [output_midi_seq, output_midi, output_audio, output_plot])
417
 
418
  app.queue(1).launch(server_port=opt.port, share=opt.share, inbrowser=True)
 
24
 
25
  #==========================================================================================================
26
 
27
+ def match_midi(midi, max_match_ratio, progress=gr.Progress()):
28
 
29
  print('=' * 70)
30
  print('Loading MIDI file...')
 
149
 
150
  #@markdown Match ratio control option
151
 
152
+ maximum_match_ratio_to_search_for = max_match_ratio #@param {type:"slider", min:0, max:1, step:0.01}
153
 
154
  #@markdown MIDI pitches search options
155
 
 
402
  "(https://colab.research.google.com/github/asigalov61/Los-Angeles-MIDI-Dataset/blob/main/Los_Angeles_MIDI_Dataset_Search_and_Explore.ipynb)"
403
  " for faster execution"
404
  )
405
+
406
+ maximum_match_ratio = gr.Slider(0.5, 1, value=1.0, label="Maximum match ratio to search for", info="Lower this value to see less precise matches")
407
 
408
  input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"], type="binary")
409
 
 
414
  output_midi = gr.File(label="Output MIDI match sample MIDI", file_types=[".mid"])
415
  output_midi_seq = gr.Textbox(label="Output MIDI match metadata")
416
 
417
+ run_event = input_midi.upload(match_midi, [input_midi, maximum_match_ratio],
418
  [output_midi_seq, output_midi, output_audio, output_plot])
419
 
420
  app.queue(1).launch(server_port=opt.port, share=opt.share, inbrowser=True)