Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
b41bffa
1
Parent(s):
497e9d9
Update app.py
Browse files
app.py
CHANGED
@@ -17,9 +17,7 @@ from midi_to_colab_audio import midi_to_colab_audio
|
|
17 |
import TMIDIX
|
18 |
|
19 |
import matplotlib.pyplot as plt
|
20 |
-
|
21 |
-
in_space = os.getenv("SYSTEM") == "spaces"
|
22 |
-
|
23 |
# =================================================================================================
|
24 |
|
25 |
@spaces.GPU
|
@@ -213,7 +211,7 @@ def InpaintPitches(input_midi, input_num_of_notes, input_patch_number):
|
|
213 |
inpaint_MIDI_patch = input_patch_number
|
214 |
|
215 |
#@markdown Generation settings
|
216 |
-
number_of_prime_notes =
|
217 |
number_of_memory_tokens = 1024 # @param {type:"slider", min:3, max:8190, step:3}
|
218 |
number_of_samples_per_inpainted_note = 1 #@param {type:"slider", min:1, max:16, step:1}
|
219 |
temperature = 0.85
|
@@ -425,15 +423,15 @@ if __name__ == "__main__":
|
|
425 |
"(https://colab.research.google.com/github/asigalov61/Giant-Music-Transformer/blob/main/Giant_Music_Transformer.ipynb)"
|
426 |
" for all features, faster execution and endless generation"
|
427 |
)
|
428 |
-
gr.Markdown("## Upload your MIDI or select a sample example MIDI")
|
429 |
|
430 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
431 |
input_num_of_notes = gr.Slider(8, 2048, value=128, step=8, label="Number of composition notes to inpaint")
|
432 |
input_patch_number = gr.Slider(0, 127, value=0, step=1, label="Composition MIDI patch to inpaint")
|
433 |
|
434 |
-
run_btn = gr.Button("
|
435 |
|
436 |
-
gr.Markdown("##
|
437 |
|
438 |
output_midi_title = gr.Textbox(label="Output MIDI title")
|
439 |
output_midi_summary = gr.Textbox(label="Output MIDI summary")
|
@@ -441,7 +439,6 @@ if __name__ == "__main__":
|
|
441 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
442 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
443 |
|
444 |
-
|
445 |
run_event = run_btn.click(InpaintPitches, [input_midi, input_num_of_notes, input_patch_number],
|
446 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
447 |
|
|
|
17 |
import TMIDIX
|
18 |
|
19 |
import matplotlib.pyplot as plt
|
20 |
+
|
|
|
|
|
21 |
# =================================================================================================
|
22 |
|
23 |
@spaces.GPU
|
|
|
211 |
inpaint_MIDI_patch = input_patch_number
|
212 |
|
213 |
#@markdown Generation settings
|
214 |
+
number_of_prime_notes = 24
|
215 |
number_of_memory_tokens = 1024 # @param {type:"slider", min:3, max:8190, step:3}
|
216 |
number_of_samples_per_inpainted_note = 1 #@param {type:"slider", min:1, max:16, step:1}
|
217 |
temperature = 0.85
|
|
|
423 |
"(https://colab.research.google.com/github/asigalov61/Giant-Music-Transformer/blob/main/Giant_Music_Transformer.ipynb)"
|
424 |
" for all features, faster execution and endless generation"
|
425 |
)
|
426 |
+
gr.Markdown("## Upload your MIDI or select a sample example MIDI below")
|
427 |
|
428 |
input_midi = gr.File(label="Input MIDI", file_types=[".midi", ".mid", ".kar"])
|
429 |
input_num_of_notes = gr.Slider(8, 2048, value=128, step=8, label="Number of composition notes to inpaint")
|
430 |
input_patch_number = gr.Slider(0, 127, value=0, step=1, label="Composition MIDI patch to inpaint")
|
431 |
|
432 |
+
run_btn = gr.Button("inpaint", variant="primary")
|
433 |
|
434 |
+
gr.Markdown("## Inpainting results")
|
435 |
|
436 |
output_midi_title = gr.Textbox(label="Output MIDI title")
|
437 |
output_midi_summary = gr.Textbox(label="Output MIDI summary")
|
|
|
439 |
output_plot = gr.Plot(label="Output MIDI score plot")
|
440 |
output_midi = gr.File(label="Output MIDI file", file_types=[".mid"])
|
441 |
|
|
|
442 |
run_event = run_btn.click(InpaintPitches, [input_midi, input_num_of_notes, input_patch_number],
|
443 |
[output_midi_title, output_midi_summary, output_midi, output_audio, output_plot])
|
444 |
|