asigalov61 commited on
Commit
115a10b
1 Parent(s): f61d244

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +25 -10
app.py CHANGED
@@ -21,7 +21,13 @@ from midi_to_colab_audio import midi_to_colab_audio
21
 
22
  # =================================================================================================
23
 
24
- def Generate_Chords_Progression(input_midi, input_sampling_resolution):
 
 
 
 
 
 
25
 
26
  print('=' * 70)
27
  print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
@@ -29,9 +35,6 @@ def Generate_Chords_Progression(input_midi, input_sampling_resolution):
29
 
30
  print('=' * 70)
31
 
32
- fn = os.path.basename(input_midi.name)
33
- fn1 = fn.split('.')[0]
34
-
35
  print('=' * 70)
36
  print('Ultimate MIDI Classifier')
37
  print('=' * 70)
@@ -168,15 +171,27 @@ if __name__ == "__main__":
168
 
169
  gr.Markdown("## Select generation options")
170
 
171
- input_sampling_resolution = gr.Slider(1, 5, value=2, step=1, label="Classification sampling resolution")
 
 
 
 
 
172
 
173
- run_btn = gr.Button("classify", variant="primary")
174
 
175
  gr.Markdown("## Generation results")
176
 
177
- output_midi_cls_summary = gr.Textbox(label="MIDI classification results")
178
-
179
- run_event = run_btn.click(ClassifyMIDI, [input_midi, input_sampling_resolution],
180
- [output_midi_cls_summary])
 
 
 
 
 
 
 
181
 
182
  app.queue().launch()
 
21
 
22
  # =================================================================================================
23
 
24
+ def Generate_Chords_Progression(total_song_length_in_chords_chunks,
25
+ chords_chunks_memory_length,
26
+ chord_time_step,
27
+ melody_MIDI_patch_number,
28
+ chords_progression_MIDI_patch_number,
29
+ base_MIDI_patch_number
30
+ ):
31
 
32
  print('=' * 70)
33
  print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
 
35
 
36
  print('=' * 70)
37
 
 
 
 
38
  print('=' * 70)
39
  print('Ultimate MIDI Classifier')
40
  print('=' * 70)
 
171
 
172
  gr.Markdown("## Select generation options")
173
 
174
+ total_song_length_in_chords_chunks = gr.Slider(5, 20, value=13, step=1, label="Total song length in chords chunks")
175
+ chords_chunks_memory_length = gr.Slider(-1, 30, value=-1, step=1, label="Chords chunks memory length")
176
+ chord_time_step = gr.Slider(100, 1000, value=500, step=50, label="Chord time step")
177
+ melody_MIDI_patch_number = gr.Slider(0, 127, value=40, step=1, label="Melody MIDI patch number")
178
+ chords_progression_MIDI_patch_number = gr.Slider(0, 127, value=0, step=1, label="Chords progression MIDI patch number")
179
+ base_MIDI_patch_number = gr.Slider(0, 127, value=35, step=1, label="Base MIDI patch number")
180
 
181
+ run_btn = gr.Button("generate", variant="primary")
182
 
183
  gr.Markdown("## Generation results")
184
 
185
+ output_cp_summary = gr.Textbox(label="Generated chords progression info and stats")
186
+
187
+ run_event = run_btn.click(Generate_Chords_Progression,
188
+ [total_song_length_in_chords_chunks,
189
+ chords_chunks_memory_length,
190
+ chord_time_step,
191
+ melody_MIDI_patch_number,
192
+ chords_progression_MIDI_patch_number,
193
+ base_MIDI_patch_number],
194
+ [output_midi_cls_summary]
195
+ )
196
 
197
  app.queue().launch()