Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
4186f2a
1
Parent(s):
8013ae6
Update app.py
Browse files
app.py
CHANGED
|
@@ -39,7 +39,7 @@ def GenerateMIDI():
|
|
| 39 |
|
| 40 |
for i in progress.tqdm(range(seq_len)):
|
| 41 |
|
| 42 |
-
|
| 43 |
x = out[:, -max_seq_len:]
|
| 44 |
|
| 45 |
torch_in = x.tolist()[0]
|
|
@@ -52,9 +52,12 @@ def GenerateMIDI():
|
|
| 52 |
|
| 53 |
out = torch.cat((out, sample), dim=-1)
|
| 54 |
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
if return_prime:
|
| 60 |
melody_chords_f = out[:, :]
|
|
@@ -130,7 +133,7 @@ def GenerateMIDI():
|
|
| 130 |
with open(f"Allegro-Music-Transformer-Music-Composition.mid", 'wb') as f:
|
| 131 |
f.write(midi_data)
|
| 132 |
|
| 133 |
-
audio = synthesis(TMIDIX.score2opus(
|
| 134 |
|
| 135 |
yield output, "Allegro-Music-Transformer-Music-Composition.mid", (44100, audio)
|
| 136 |
|
|
|
|
| 39 |
|
| 40 |
for i in progress.tqdm(range(seq_len)):
|
| 41 |
|
| 42 |
+
try:
|
| 43 |
x = out[:, -max_seq_len:]
|
| 44 |
|
| 45 |
torch_in = x.tolist()[0]
|
|
|
|
| 52 |
|
| 53 |
out = torch.cat((out, sample), dim=-1)
|
| 54 |
|
| 55 |
+
if i % 16 == 0:
|
| 56 |
+
print(i, '/', seq_len)
|
| 57 |
+
|
| 58 |
+
except Exception as e:
|
| 59 |
+
print('Error', e)
|
| 60 |
+
break
|
| 61 |
|
| 62 |
if return_prime:
|
| 63 |
melody_chords_f = out[:, :]
|
|
|
|
| 133 |
with open(f"Allegro-Music-Transformer-Music-Composition.mid", 'wb') as f:
|
| 134 |
f.write(midi_data)
|
| 135 |
|
| 136 |
+
audio = synthesis(TMIDIX.score2opus(song_f), 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2')
|
| 137 |
|
| 138 |
yield output, "Allegro-Music-Transformer-Music-Composition.mid", (44100, audio)
|
| 139 |
|