Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -109,8 +109,10 @@ 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(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])
|
@@ -149,10 +151,11 @@ with gr.Blocks() as demo:
|
|
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__":
|
|
|
109 |
note_sequence.total_time = total_time
|
110 |
return note_sequence
|
111 |
|
112 |
+
def process(num1, num2, num3):
|
113 |
+
created_text = f"""PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST={num1} BAR_START NOTE_ON={num2}"""
|
114 |
+
NOTE_LENGTH_16TH_120BPM = 0.25 * 60 / num3
|
115 |
+
BAR_LENGTH_120BPM = 4.0 * 60 / num3
|
116 |
input_ids = tokenizer.encode(created_text, return_tensors="pt")
|
117 |
generated_ids = model.generate(input_ids, max_length=500)
|
118 |
generated_sequence = tokenizer.decode(generated_ids[0])
|
|
|
151 |
#audio_button = gr.Button("generate audio")
|
152 |
number1 = gr.Slider(1, 100, value=25, label="Inst number", step=1, info="Choose between 1 and 100")
|
153 |
number2 = gr.Slider(1, 100, value=40, label="Note number", step=1, info="Choose between 1 and 100")
|
154 |
+
number3 = gr.Slider(60, 140, value=120, label="BPM", step=5, info="Choose between 60 and 140")
|
155 |
audio_button = gr.Button("generate audio")
|
156 |
|
157 |
text_button.click(generation, inputs=text_input, outputs=text_output)
|
158 |
+
audio_button.click(process, inputs=[number1, number2, number3], outputs=audio_output)
|
159 |
|
160 |
|
161 |
if __name__ == "__main__":
|