Spaces:
Running
on
Zero
Running
on
Zero
asigalov61
commited on
Commit
•
6c71f04
1
Parent(s):
606e959
Update app.py
Browse files
app.py
CHANGED
@@ -27,15 +27,14 @@ in_space = os.getenv("SYSTEM") == "spaces"
|
|
27 |
|
28 |
@torch.no_grad()
|
29 |
def GenerateMIDI(num_tok, idrums, iinstr):
|
30 |
-
print('=' * 70)
|
31 |
print('Req time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
32 |
start_time = time.time()
|
33 |
|
34 |
-
print('
|
35 |
print('Req num tok:', num_tok)
|
36 |
print('Req instr:', iinstr)
|
37 |
print('Drums:', idrums)
|
38 |
-
print('
|
39 |
|
40 |
if idrums:
|
41 |
drums = 3074
|
@@ -50,7 +49,7 @@ def GenerateMIDI(num_tok, idrums, iinstr):
|
|
50 |
|
51 |
print('Selected Improv sequence:')
|
52 |
print(start_tokens)
|
53 |
-
print('
|
54 |
|
55 |
output_signature = 'Allegro Music Transformer'
|
56 |
output_file_name = 'Allegro-Music-Transformer-Music-Composition'
|
@@ -126,9 +125,8 @@ def GenerateMIDI(num_tok, idrums, iinstr):
|
|
126 |
|
127 |
audio = synthesis(TMIDIX.score2opus(output), 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2')
|
128 |
|
129 |
-
print('=' * 70)
|
130 |
print('Sample output INTs', outy[:16])
|
131 |
-
print('
|
132 |
print('Req execution time:', (time.time() - start_time), 'sec')
|
133 |
print('=' * 70)
|
134 |
|
@@ -190,14 +188,18 @@ def create_msg(name, data):
|
|
190 |
|
191 |
|
192 |
if __name__ == "__main__":
|
|
|
|
|
|
|
193 |
print('=' * 70)
|
|
|
|
|
|
|
194 |
parser = argparse.ArgumentParser()
|
195 |
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
|
196 |
parser.add_argument("--port", type=int, default=7860, help="gradio server port")
|
197 |
opt = parser.parse_args()
|
198 |
|
199 |
-
PDT = timezone('US/Pacific')
|
200 |
-
|
201 |
print('Loading model...')
|
202 |
|
203 |
SEQ_LEN = 2048
|
@@ -227,6 +229,7 @@ if __name__ == "__main__":
|
|
227 |
model.eval()
|
228 |
|
229 |
print('Done!')
|
|
|
230 |
|
231 |
load_javascript()
|
232 |
app = gr.Blocks()
|
|
|
27 |
|
28 |
@torch.no_grad()
|
29 |
def GenerateMIDI(num_tok, idrums, iinstr):
|
|
|
30 |
print('Req time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
31 |
start_time = time.time()
|
32 |
|
33 |
+
print('-' * 70)
|
34 |
print('Req num tok:', num_tok)
|
35 |
print('Req instr:', iinstr)
|
36 |
print('Drums:', idrums)
|
37 |
+
print('-' * 70)
|
38 |
|
39 |
if idrums:
|
40 |
drums = 3074
|
|
|
49 |
|
50 |
print('Selected Improv sequence:')
|
51 |
print(start_tokens)
|
52 |
+
print('-' * 70)
|
53 |
|
54 |
output_signature = 'Allegro Music Transformer'
|
55 |
output_file_name = 'Allegro-Music-Transformer-Music-Composition'
|
|
|
125 |
|
126 |
audio = synthesis(TMIDIX.score2opus(output), 'SGM-v2.01-YamahaGrand-Guit-Bass-v2.7.sf2')
|
127 |
|
|
|
128 |
print('Sample output INTs', outy[:16])
|
129 |
+
print('-' * 70)
|
130 |
print('Req execution time:', (time.time() - start_time), 'sec')
|
131 |
print('=' * 70)
|
132 |
|
|
|
188 |
|
189 |
|
190 |
if __name__ == "__main__":
|
191 |
+
|
192 |
+
PDT = timezone('US/Pacific')
|
193 |
+
|
194 |
print('=' * 70)
|
195 |
+
print('App start time: {:%Y-%m-%d %H:%M:%S}'.format(datetime.datetime.now(PDT)))
|
196 |
+
print('=' * 70)
|
197 |
+
|
198 |
parser = argparse.ArgumentParser()
|
199 |
parser.add_argument("--share", action="store_true", default=False, help="share gradio app")
|
200 |
parser.add_argument("--port", type=int, default=7860, help="gradio server port")
|
201 |
opt = parser.parse_args()
|
202 |
|
|
|
|
|
203 |
print('Loading model...')
|
204 |
|
205 |
SEQ_LEN = 2048
|
|
|
229 |
model.eval()
|
230 |
|
231 |
print('Done!')
|
232 |
+
print('=' * 70)
|
233 |
|
234 |
load_javascript()
|
235 |
app = gr.Blocks()
|