Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -118,7 +118,7 @@ def GenerateMIDI(num_tok, idrums, iinstr):
|
|
118 |
pitch = 0
|
119 |
channel = 0
|
120 |
|
121 |
-
for i in range(max(1, min(
|
122 |
|
123 |
inp = torch.LongTensor([outy]).cuda()
|
124 |
|
@@ -154,7 +154,7 @@ def GenerateMIDI(num_tok, idrums, iinstr):
|
|
154 |
|
155 |
output_plot = TMIDIX.plot_ms_SONG(output[2], plot_title='Allegro-Music-Transformer-Composition', return_plt=True)
|
156 |
|
157 |
-
audio = midi_to_colab_audio(
|
158 |
soundfont_path="SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2",
|
159 |
sample_rate=16000,
|
160 |
volume_scale=10,
|
@@ -197,7 +197,7 @@ if __name__ == "__main__":
|
|
197 |
input_instrument = gr.Radio(
|
198 |
["Piano", "Guitar", "Bass", "Violin", "Cello", "Harp", "Trumpet", "Sax", "Flute", "Choir", "Organ"],
|
199 |
value="Piano", label="Lead Instrument Controls", info="Desired lead instrument")
|
200 |
-
input_num_tokens = gr.Slider(16,
|
201 |
run_btn = gr.Button("generate", variant="primary")
|
202 |
|
203 |
output_plot = gr.Plot(label='output plot')
|
|
|
118 |
pitch = 0
|
119 |
channel = 0
|
120 |
|
121 |
+
for i in range(max(1, min(1024, num_tok))):
|
122 |
|
123 |
inp = torch.LongTensor([outy]).cuda()
|
124 |
|
|
|
154 |
|
155 |
output_plot = TMIDIX.plot_ms_SONG(output[2], plot_title='Allegro-Music-Transformer-Composition', return_plt=True)
|
156 |
|
157 |
+
audio = midi_to_colab_audio('Allegro-Music-Transformer-Composition.mid',
|
158 |
soundfont_path="SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2",
|
159 |
sample_rate=16000,
|
160 |
volume_scale=10,
|
|
|
197 |
input_instrument = gr.Radio(
|
198 |
["Piano", "Guitar", "Bass", "Violin", "Cello", "Harp", "Trumpet", "Sax", "Flute", "Choir", "Organ"],
|
199 |
value="Piano", label="Lead Instrument Controls", info="Desired lead instrument")
|
200 |
+
input_num_tokens = gr.Slider(16, 1024, value=512, label="Number of Tokens", info="Number of tokens to generate")
|
201 |
run_btn = gr.Button("generate", variant="primary")
|
202 |
|
203 |
output_plot = gr.Plot(label='output plot')
|