Spaces:
Runtime error
Runtime error
Commit
·
d21df2e
1
Parent(s):
08e7ecc
Update app.py
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import note_seq
|
|
4 |
from bokeh.embed import file_html
|
5 |
from bokeh.resources import CDN
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
|
|
7 |
|
8 |
tokenizer = AutoTokenizer.from_pretrained("TristanBehrens/js-fakes-4bars")
|
9 |
model = AutoModelForCausalLM.from_pretrained("TristanBehrens/js-fakes-4bars")
|
@@ -122,7 +123,9 @@ def process(text):
|
|
122 |
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
123 |
note_plot = note_seq.plot_sequence(note_sequence, False)
|
124 |
html = file_html(note_plot, CDN)
|
125 |
-
|
|
|
|
|
126 |
|
127 |
title = "Music generation with GPT-2"
|
128 |
|
|
|
4 |
from bokeh.embed import file_html
|
5 |
from bokeh.resources import CDN
|
6 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
7 |
+
import scipy.io.wavfile
|
8 |
|
9 |
tokenizer = AutoTokenizer.from_pretrained("TristanBehrens/js-fakes-4bars")
|
10 |
model = AutoModelForCausalLM.from_pretrained("TristanBehrens/js-fakes-4bars")
|
|
|
123 |
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
124 |
note_plot = note_seq.plot_sequence(note_sequence, False)
|
125 |
html = file_html(note_plot, CDN)
|
126 |
+
|
127 |
+
scipy.io.wavfile.write("tmp_output.wav", SAMPLE_RATE, array_of_floats)
|
128 |
+
return "tmp_output.wav", html
|
129 |
|
130 |
title = "Music generation with GPT-2"
|
131 |
|