Spaces:
Running
on
Zero
Running
on
Zero
mrfakename
commited on
Commit
•
110867f
1
Parent(s):
1a376e8
Update app.py
Browse files
app.py
CHANGED
@@ -19,7 +19,8 @@ def gen(piano_only, piano_seed, length):
|
|
19 |
ccc = '<pad>'
|
20 |
for item in musicgen(ccc, piano_only=piano_only, length=length):
|
21 |
midi = item
|
22 |
-
yield item, None, None, None
|
|
|
23 |
bio = BytesIO()
|
24 |
cfg = VocabConfig.from_json('./vocab_config.json')
|
25 |
text = midi.strip()
|
@@ -27,11 +28,12 @@ def gen(piano_only, piano_seed, length):
|
|
27 |
with tempfile.NamedTemporaryFile(suffix='.midi', delete=False) as tmp, tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as aud:
|
28 |
mid.save(tmp.name)
|
29 |
fs.midi_to_audio(tmp.name, aud.name)
|
30 |
-
yield midi, tmp.name, aud.name, gr.update(visible=True, value="Continue ➡️")
|
|
|
31 |
@spaces.GPU(enable_queue=True)
|
32 |
def continueit(piano_only, piano_seed, length, txtout):
|
33 |
midi = ''
|
34 |
-
for item in musicgen(txtout.strip().strip('<end>').strip(), piano_only=piano_only, length=length):
|
35 |
midi = item
|
36 |
yield item, None, None
|
37 |
bio = BytesIO()
|
@@ -56,6 +58,6 @@ with gr.Blocks() as demo:
|
|
56 |
fileout = gr.File(interactive=False, label="MIDI File", type="binary")
|
57 |
audioout = gr.Audio(interactive=False, label="Audio")
|
58 |
continuebtn = gr.Button("Continue ➡️", visible=False)
|
59 |
-
synth.click(gen, inputs=[piano_only, piano_seed, length], outputs=[txtout, fileout, audioout
|
60 |
-
continuebtn.click(gen, inputs=[piano_only, piano_seed, length, txtout], outputs=[txtout, fileout, audioout])
|
61 |
demo.queue(api_open=False, default_concurrency_limit=5).launch(show_api=False)
|
|
|
19 |
ccc = '<pad>'
|
20 |
for item in musicgen(ccc, piano_only=piano_only, length=length):
|
21 |
midi = item
|
22 |
+
# yield item, None, None, None
|
23 |
+
yield item, None, None
|
24 |
bio = BytesIO()
|
25 |
cfg = VocabConfig.from_json('./vocab_config.json')
|
26 |
text = midi.strip()
|
|
|
28 |
with tempfile.NamedTemporaryFile(suffix='.midi', delete=False) as tmp, tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as aud:
|
29 |
mid.save(tmp.name)
|
30 |
fs.midi_to_audio(tmp.name, aud.name)
|
31 |
+
# yield midi, tmp.name, aud.name, gr.update(visible=True, value="Continue ➡️")
|
32 |
+
yield midi, tmp.name, aud.name
|
33 |
@spaces.GPU(enable_queue=True)
|
34 |
def continueit(piano_only, piano_seed, length, txtout):
|
35 |
midi = ''
|
36 |
+
for item in musicgen(txtout.strip().strip('<end>').strip() + ' ', piano_only=piano_only, length=length):
|
37 |
midi = item
|
38 |
yield item, None, None
|
39 |
bio = BytesIO()
|
|
|
58 |
fileout = gr.File(interactive=False, label="MIDI File", type="binary")
|
59 |
audioout = gr.Audio(interactive=False, label="Audio")
|
60 |
continuebtn = gr.Button("Continue ➡️", visible=False)
|
61 |
+
synth.click(gen, inputs=[piano_only, piano_seed, length], outputs=[txtout, fileout, audioout])
|
62 |
+
# continuebtn.click(gen, inputs=[piano_only, piano_seed, length, txtout], outputs=[txtout, fileout, audioout])
|
63 |
demo.queue(api_open=False, default_concurrency_limit=5).launch(show_api=False)
|