Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -109,9 +109,9 @@ def empty_note_sequence(qpm=120.0, total_time=0.0):
|
|
109 |
note_sequence.total_time = total_time
|
110 |
return note_sequence
|
111 |
|
112 |
-
def process(
|
113 |
-
|
114 |
-
input_ids = tokenizer.encode(
|
115 |
generated_ids = model.generate(input_ids, max_length=500)
|
116 |
generated_sequence = tokenizer.decode(generated_ids[0])
|
117 |
|
@@ -137,9 +137,6 @@ def identity(x, state):
|
|
137 |
state += 1
|
138 |
return x, state, state
|
139 |
|
140 |
-
def sentence_builder(quantity1, quantity2):
|
141 |
-
created_sentence = f"""PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST={quantity1} BAR_START NOTE_ON={quantity2}"""
|
142 |
-
|
143 |
with gr.Blocks() as demo:
|
144 |
gr.Markdown("Midi Generation")
|
145 |
with gr.Tab("Token generation"):
|
@@ -149,15 +146,13 @@ with gr.Blocks() as demo:
|
|
149 |
with gr.Tab("Audio generation"):
|
150 |
text_input = gr.Textbox()
|
151 |
audio_output = gr.Audio()
|
|
|
|
|
|
|
152 |
audio_button = gr.Button("generate audio")
|
153 |
-
sentence_builder,
|
154 |
-
[
|
155 |
-
gr.Slider(1, 100, value=25, label="Inst number", step=1, info="Choose between 1 and 100"),
|
156 |
-
gr.Slider(1, 100, value=40, label="Note number", step=1, info="Choose between 1 and 100")
|
157 |
-
]
|
158 |
|
159 |
text_button.click(generation, inputs=text_input, outputs=text_output)
|
160 |
-
audio_button.click(process, inputs=
|
161 |
|
162 |
|
163 |
if __name__ == "__main__":
|
|
|
109 |
note_sequence.total_time = total_time
|
110 |
return note_sequence
|
111 |
|
112 |
+
def process(num1, num2):
|
113 |
+
created_text = f"""PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST={num1} BAR_START NOTE_ON={num2}"""
|
114 |
+
input_ids = tokenizer.encode(created_text, return_tensors="pt")
|
115 |
generated_ids = model.generate(input_ids, max_length=500)
|
116 |
generated_sequence = tokenizer.decode(generated_ids[0])
|
117 |
|
|
|
137 |
state += 1
|
138 |
return x, state, state
|
139 |
|
|
|
|
|
|
|
140 |
with gr.Blocks() as demo:
|
141 |
gr.Markdown("Midi Generation")
|
142 |
with gr.Tab("Token generation"):
|
|
|
146 |
with gr.Tab("Audio generation"):
|
147 |
text_input = gr.Textbox()
|
148 |
audio_output = gr.Audio()
|
149 |
+
#audio_button = gr.Button("generate audio")
|
150 |
+
number1 = gr.Slider(1, 100, value=25, label="Inst number", step=1, info="Choose between 1 and 100")
|
151 |
+
number2 = gr.Slider(1, 100, value=40, label="Note number", step=1, info="Choose between 1 and 100")
|
152 |
audio_button = gr.Button("generate audio")
|
|
|
|
|
|
|
|
|
|
|
153 |
|
154 |
text_button.click(generation, inputs=text_input, outputs=text_output)
|
155 |
+
audio_button.click(process, inputs=[number1, number2], outputs=audio_output)
|
156 |
|
157 |
|
158 |
if __name__ == "__main__":
|