Spaces:
Runtime error
Runtime error
Omar Sanseviero
commited on
Commit
·
eb89751
1
Parent(s):
e12c7d6
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,7 @@ import gradio as gr
|
|
| 2 |
import note_seq
|
| 3 |
|
| 4 |
from bokeh.embed import file_html
|
|
|
|
| 5 |
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 6 |
|
| 7 |
tokenizer = AutoTokenizer.from_pretrained("TristanBehrens/js-fakes-4bars")
|
|
@@ -120,14 +121,14 @@ def process(text):
|
|
| 120 |
synth = note_seq.midi_synth.synthesize
|
| 121 |
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
| 122 |
note_plot = note_seq.plot_sequence(note_sequence)
|
| 123 |
-
html = file_html(note_plot)
|
| 124 |
return (SAMPLE_RATE, array_of_floats), html
|
| 125 |
|
| 126 |
title = "Music generation with GPT-2"
|
| 127 |
|
| 128 |
iface = gr.Interface(
|
| 129 |
fn=process,
|
| 130 |
-
inputs=[gr.inputs.Textbox(
|
| 131 |
outputs=['audio', 'html'],
|
| 132 |
title=title,
|
| 133 |
examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]]
|
|
|
|
| 2 |
import note_seq
|
| 3 |
|
| 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")
|
|
|
|
| 121 |
synth = note_seq.midi_synth.synthesize
|
| 122 |
array_of_floats = synth(note_sequence, sample_rate=SAMPLE_RATE)
|
| 123 |
note_plot = note_seq.plot_sequence(note_sequence)
|
| 124 |
+
html = file_html(note_plot, CDN)
|
| 125 |
return (SAMPLE_RATE, array_of_floats), html
|
| 126 |
|
| 127 |
title = "Music generation with GPT-2"
|
| 128 |
|
| 129 |
iface = gr.Interface(
|
| 130 |
fn=process,
|
| 131 |
+
inputs=[gr.inputs.Textbox(default="PIECE_START")],
|
| 132 |
outputs=['audio', 'html'],
|
| 133 |
title=title,
|
| 134 |
examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]]
|