Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
77b1713
1
Parent(s):
fb0ff2b
Update app.py
Browse files
app.py
CHANGED
@@ -233,6 +233,11 @@ def Generate_Rock_Song(input_midi,
|
|
233 |
|
234 |
gen_tokens = []
|
235 |
|
|
|
|
|
|
|
|
|
|
|
236 |
while pcount < max_num_ptcs and y > 255 and tries < max_tries:
|
237 |
|
238 |
x = torch.tensor(input[-input_num_memory_tokens:], dtype=torch.long, device=DEVICE)
|
@@ -248,14 +253,23 @@ def Generate_Rock_Song(input_midi,
|
|
248 |
|
249 |
y = out[0].tolist()[0]
|
250 |
|
251 |
-
if
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
|
257 |
-
|
258 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
|
260 |
return gen_tokens
|
261 |
|
|
|
233 |
|
234 |
gen_tokens = []
|
235 |
|
236 |
+
seen = False
|
237 |
+
|
238 |
+
if 256 < input[-1] < 544:
|
239 |
+
seen = True
|
240 |
+
|
241 |
while pcount < max_num_ptcs and y > 255 and tries < max_tries:
|
242 |
|
243 |
x = torch.tensor(input[-input_num_memory_tokens:], dtype=torch.long, device=DEVICE)
|
|
|
253 |
|
254 |
y = out[0].tolist()[0]
|
255 |
|
256 |
+
if 256 < y < 544:
|
257 |
+
if not seen:
|
258 |
+
input.append(y)
|
259 |
+
gen_tokens.append(y)
|
260 |
+
seen = True
|
261 |
|
262 |
+
else:
|
263 |
+
tries += 1
|
264 |
+
|
265 |
+
if y > 544 and seen:
|
266 |
+
if pcount < max_num_ptcs and y not in gen_tokens:
|
267 |
+
input.append(y)
|
268 |
+
gen_tokens.append(y)
|
269 |
+
pcount += 1
|
270 |
+
|
271 |
+
else:
|
272 |
+
tries += 1
|
273 |
|
274 |
return gen_tokens
|
275 |
|