Spaces:
Runtime error
Runtime error
Omar Sanseviero
commited on
Commit
·
6c2ca73
1
Parent(s):
e879262
Update app.py
Browse files
app.py
CHANGED
|
@@ -122,18 +122,16 @@ def process(text):
|
|
| 122 |
synth = note_seq.midi_synth.synthesize
|
| 123 |
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
| 124 |
note_plot = note_seq.plot_sequence(note_sequence, False)
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
scipy.io.wavfile.write(fp.name, SAMPLE_RATE, array_of_floats)
|
| 129 |
-
return fp.name, html
|
| 130 |
|
| 131 |
title = "Music generation with GPT-2"
|
| 132 |
|
| 133 |
iface = gr.Interface(
|
| 134 |
fn=process,
|
| 135 |
inputs=[gr.inputs.Textbox(default="PIECE_START")],
|
| 136 |
-
outputs=['audio'
|
| 137 |
title=title,
|
| 138 |
examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]]
|
| 139 |
)
|
|
|
|
| 122 |
synth = note_seq.midi_synth.synthesize
|
| 123 |
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
| 124 |
note_plot = note_seq.plot_sequence(note_sequence, False)
|
| 125 |
+
array_of_floats /=1.414
|
| 126 |
+
array_of_floats *= 32767
|
| 127 |
+
int16_data = array_of_floats.astype(np.int16)
|
|
|
|
|
|
|
| 128 |
|
| 129 |
title = "Music generation with GPT-2"
|
| 130 |
|
| 131 |
iface = gr.Interface(
|
| 132 |
fn=process,
|
| 133 |
inputs=[gr.inputs.Textbox(default="PIECE_START")],
|
| 134 |
+
outputs=['audio'],
|
| 135 |
title=title,
|
| 136 |
examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]]
|
| 137 |
)
|