Update app.py
Browse files
app.py
CHANGED
|
@@ -131,25 +131,43 @@ def generation(text):
|
|
| 131 |
generated_sequence = tokenizer.decode(generated_ids[0])
|
| 132 |
return generated_sequence
|
| 133 |
|
| 134 |
-
title = "Music gen with GPT-2"
|
| 135 |
-
title2 = "Midi token generation"
|
| 136 |
-
|
| 137 |
-
iface = gr.Interface(
|
| 138 |
-
fn=process,
|
| 139 |
-
inputs=["text"],
|
| 140 |
-
outputs=['audio'],
|
| 141 |
-
title=title,
|
| 142 |
#examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]],
|
| 143 |
-
article="This demo is inspired in the notebook from https://huggingface.co/TristanBehrens/js-fakes-4bars."
|
| 144 |
-
)
|
| 145 |
-
|
| 146 |
-
iface2 = gr.Interface(
|
| 147 |
-
fn=generation,
|
| 148 |
-
inputs=["text"],
|
| 149 |
-
outputs=["text"],
|
| 150 |
-
title=title2,
|
| 151 |
-
article="This will generate the encoded text that represents Midi language."
|
| 152 |
-
)
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 131 |
generated_sequence = tokenizer.decode(generated_ids[0])
|
| 132 |
return generated_sequence
|
| 133 |
|
| 134 |
+
#title = "Music gen with GPT-2"
|
| 135 |
+
#title2 = "Midi token generation"
|
| 136 |
+
|
| 137 |
+
#iface = gr.Interface(
|
| 138 |
+
# fn=process,
|
| 139 |
+
# inputs=["text"],
|
| 140 |
+
# outputs=['audio'],
|
| 141 |
+
# title=title,
|
| 142 |
#examples=[["PIECE_START"], ["PIECE_START STYLE=JSFAKES GENRE=JSFAKES TRACK_START INST=48 BAR_START NOTE_ON=61"]],
|
| 143 |
+
# article="This demo is inspired in the notebook from https://huggingface.co/TristanBehrens/js-fakes-4bars."
|
| 144 |
+
#)
|
| 145 |
+
|
| 146 |
+
#iface2 = gr.Interface(
|
| 147 |
+
# fn=generation,
|
| 148 |
+
# inputs=["text"],
|
| 149 |
+
# outputs=["text"],
|
| 150 |
+
# title=title2,
|
| 151 |
+
# article="This will generate the encoded text that represents Midi language."
|
| 152 |
+
#)
|
| 153 |
+
|
| 154 |
+
|
| 155 |
+
with gr.Blocks() as demo:
|
| 156 |
+
gr.Markdown("Midi Generation")
|
| 157 |
+
with gr.Tab("Token generation"):
|
| 158 |
+
text_input = gr.Textbox()
|
| 159 |
+
text_output = gr.Textbox()
|
| 160 |
+
text_button = gr.button("generate tokens")
|
| 161 |
+
with gr.Tab("Audio generation"):
|
| 162 |
+
text_input = gr.Textbox()
|
| 163 |
+
audio_output = gr.Audio()
|
| 164 |
+
audio_button = gr.button("generate audio")
|
| 165 |
+
|
| 166 |
+
text_button.click(generation, inputs=text_input, outputs=text_output)
|
| 167 |
+
audio_button.click(process, inputs=text_input, outputs=audio_output)
|
| 168 |
+
|
| 169 |
+
|
| 170 |
+
if __name__ == "__main__":
|
| 171 |
+
demo.launch(
|
| 172 |
+
|
| 173 |
+
#iface.launch(debug=True)
|