Update app.py
Browse files
app.py
CHANGED
|
@@ -235,14 +235,7 @@ def Inpaint_Pitches(input_midi,
|
|
| 235 |
print('=' * 70)
|
| 236 |
print('Inpainting...')
|
| 237 |
|
| 238 |
-
|
| 239 |
-
inpaint_every_nth_note = 1
|
| 240 |
-
forbid_original_pitches = True
|
| 241 |
-
max_inpainted_pitch_dev = 12
|
| 242 |
-
max_inpaint_tries_per_note = 20
|
| 243 |
-
|
| 244 |
-
num_prime_tokens = 128
|
| 245 |
-
num_mem_tokens = 4096
|
| 246 |
|
| 247 |
notes_counter = 0
|
| 248 |
|
|
@@ -255,7 +248,7 @@ def Inpaint_Pitches(input_midi,
|
|
| 255 |
old_patch = (t-256) // 128
|
| 256 |
old_pitch = (t-256) % 128
|
| 257 |
|
| 258 |
-
if old_patch in
|
| 259 |
|
| 260 |
x = torch.LongTensor(inpainted_song[-num_mem_tokens:]).cuda()
|
| 261 |
|
|
|
|
| 235 |
print('=' * 70)
|
| 236 |
print('Inpainting...')
|
| 237 |
|
| 238 |
+
ipatches = [patch2number[instr] for instr in patches_to_inpaint]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 239 |
|
| 240 |
notes_counter = 0
|
| 241 |
|
|
|
|
| 248 |
old_patch = (t-256) // 128
|
| 249 |
old_pitch = (t-256) % 128
|
| 250 |
|
| 251 |
+
if old_patch in ipatches and notes_counter % inpaint_every_nth_note == 0:
|
| 252 |
|
| 253 |
x = torch.LongTensor(inpainted_song[-num_mem_tokens:]).cuda()
|
| 254 |
|