asigalov61
commited on
Commit
•
1424ad3
1
Parent(s):
8ea7c59
Update app.py
Browse files
app.py
CHANGED
@@ -27,12 +27,15 @@ def render_midi(input_midi,
|
|
27 |
custom_render_patch,
|
28 |
render_transpose_value,
|
29 |
render_transpose_to_C4,
|
30 |
-
render_align
|
31 |
-
|
|
|
|
|
32 |
|
33 |
print('*' * 70)
|
34 |
print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
35 |
start_time = time.time()
|
|
|
36 |
print('=' * 70)
|
37 |
print('Loading MIDI...')
|
38 |
|
@@ -43,6 +46,8 @@ def render_midi(input_midi,
|
|
43 |
|
44 |
input_midi_md5hash = hashlib.md5(fdata).hexdigest()
|
45 |
|
|
|
|
|
46 |
print('=' * 70)
|
47 |
print('Input MIDI file name:', fn)
|
48 |
print('Input MIDI md5 hash', input_midi_md5hash)
|
@@ -53,6 +58,8 @@ def render_midi(input_midi,
|
|
53 |
print('Transpose value:', render_transpose_value)
|
54 |
print('Transpose to C4', render_transpose_to_C4)
|
55 |
print('Align to bars:', render_align)
|
|
|
|
|
56 |
print('=' * 70)
|
57 |
print('Processing MIDI...Please wait...')
|
58 |
|
@@ -136,6 +143,12 @@ def render_midi(input_midi,
|
|
136 |
output_score = TMIDIX.recalculate_score_timings(output_score)
|
137 |
output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
|
138 |
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
if render_type == "Summarize":
|
140 |
sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score)
|
141 |
bmatrix = TMIDIX.escore_notes_to_binary_matrix(sp_escore_notes)
|
@@ -293,6 +306,9 @@ if __name__ == "__main__":
|
|
293 |
value="Do not align"
|
294 |
)
|
295 |
|
|
|
|
|
|
|
296 |
submit = gr.Button()
|
297 |
|
298 |
gr.Markdown("## Render results")
|
@@ -311,7 +327,9 @@ if __name__ == "__main__":
|
|
311 |
custom_render_patch,
|
312 |
render_transpose_value,
|
313 |
render_transpose_to_C4,
|
314 |
-
render_align
|
|
|
|
|
315 |
],
|
316 |
[output_midi_md5,
|
317 |
output_midi_title,
|
|
|
27 |
custom_render_patch,
|
28 |
render_transpose_value,
|
29 |
render_transpose_to_C4,
|
30 |
+
render_align,
|
31 |
+
render_output_as_solo_piano,
|
32 |
+
render_remove_drums
|
33 |
+
):
|
34 |
|
35 |
print('*' * 70)
|
36 |
print('Req start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
37 |
start_time = time.time()
|
38 |
+
|
39 |
print('=' * 70)
|
40 |
print('Loading MIDI...')
|
41 |
|
|
|
46 |
|
47 |
input_midi_md5hash = hashlib.md5(fdata).hexdigest()
|
48 |
|
49 |
+
print('=' * 70)
|
50 |
+
print('Requested settings:')
|
51 |
print('=' * 70)
|
52 |
print('Input MIDI file name:', fn)
|
53 |
print('Input MIDI md5 hash', input_midi_md5hash)
|
|
|
58 |
print('Transpose value:', render_transpose_value)
|
59 |
print('Transpose to C4', render_transpose_to_C4)
|
60 |
print('Align to bars:', render_align)
|
61 |
+
print('Output as Solo Piano', render_output_as_solo_piano)
|
62 |
+
print('Remove drums:', render_remove_drums)
|
63 |
print('=' * 70)
|
64 |
print('Processing MIDI...Please wait...')
|
65 |
|
|
|
143 |
output_score = TMIDIX.recalculate_score_timings(output_score)
|
144 |
output_score = TMIDIX.align_escore_notes_to_bars(output_score, split_durations=True)
|
145 |
|
146 |
+
if render_remove_drums:
|
147 |
+
output_score = TMIDIX.strip_drums_from_escore_notes(output_score)
|
148 |
+
|
149 |
+
if render_output_as_solo_piano:
|
150 |
+
output_score = TMIDIX.solo_piano_escore_notes(output_score)
|
151 |
+
|
152 |
if render_type == "Summarize":
|
153 |
sp_escore_notes = TMIDIX.solo_piano_escore_notes(output_score)
|
154 |
bmatrix = TMIDIX.escore_notes_to_binary_matrix(sp_escore_notes)
|
|
|
306 |
value="Do not align"
|
307 |
)
|
308 |
|
309 |
+
render_output_as_solo_piano = gr.Checkbox(label="Output as Solo Piano", value=False)
|
310 |
+
render_remove_drums = gr.Checkbox(label="Remove drums", value=False)
|
311 |
+
|
312 |
submit = gr.Button()
|
313 |
|
314 |
gr.Markdown("## Render results")
|
|
|
327 |
custom_render_patch,
|
328 |
render_transpose_value,
|
329 |
render_transpose_to_C4,
|
330 |
+
render_align,
|
331 |
+
render_output_as_solo_piano,
|
332 |
+
render_remove_drums
|
333 |
],
|
334 |
[output_midi_md5,
|
335 |
output_midi_title,
|