Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
5d8506a
1
Parent(s):
8ef0b3c
Update app.py
Browse files
app.py
CHANGED
@@ -18,7 +18,7 @@ in_space = os.getenv("SYSTEM") == "spaces"
|
|
18 |
#=================================================================================================
|
19 |
|
20 |
@torch.no_grad()
|
21 |
-
def GenerateMIDI():
|
22 |
|
23 |
start_tokens = [3087, 3073+1, 3075+1]
|
24 |
seq_len = 512
|
@@ -26,7 +26,7 @@ def GenerateMIDI():
|
|
26 |
temperature = 1.0
|
27 |
verbose=False
|
28 |
return_prime=False
|
29 |
-
|
30 |
|
31 |
out = torch.FloatTensor([start_tokens])
|
32 |
|
@@ -58,15 +58,13 @@ def GenerateMIDI():
|
|
58 |
|
59 |
step += 1
|
60 |
|
61 |
-
|
62 |
-
|
63 |
|
64 |
except Exception as e:
|
65 |
print('Error', e)
|
66 |
break
|
67 |
|
68 |
-
|
69 |
-
|
70 |
if return_prime:
|
71 |
melody_chords_f = out[:, :]
|
72 |
|
|
|
18 |
#=================================================================================================
|
19 |
|
20 |
@torch.no_grad()
|
21 |
+
def GenerateMIDI(progress=gr.Progress()):
|
22 |
|
23 |
start_tokens = [3087, 3073+1, 3075+1]
|
24 |
seq_len = 512
|
|
|
26 |
temperature = 1.0
|
27 |
verbose=False
|
28 |
return_prime=False
|
29 |
+
|
30 |
|
31 |
out = torch.FloatTensor([start_tokens])
|
32 |
|
|
|
58 |
|
59 |
step += 1
|
60 |
|
61 |
+
if step >= seq_len:
|
62 |
+
break
|
63 |
|
64 |
except Exception as e:
|
65 |
print('Error', e)
|
66 |
break
|
67 |
|
|
|
|
|
68 |
if return_prime:
|
69 |
melody_chords_f = out[:, :]
|
70 |
|