Spaces:
Sleeping
Sleeping
thecollabagepatch
commited on
Commit
·
6366f6f
1
Parent(s):
dd93602
more links
Browse files
app.py
CHANGED
@@ -170,23 +170,25 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
170 |
|
171 |
# Define the expandable sections
|
172 |
musiclang_blurb = """
|
173 |
-
##
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
"""
|
178 |
|
179 |
musicgen_blurb = """
|
180 |
## musicgen
|
181 |
musicgen is a transformer-based music model that generates audio. It can also do something called a continuation, which was initially meant to extend musicgen outputs beyond 30 seconds. it can be used with any input audio to produce surprising results.
|
182 |
-
|
|
|
|
|
183 |
"""
|
184 |
|
185 |
finetunes_blurb = """
|
186 |
-
##
|
187 |
the fine-tunes hosted on the huggingface hub are provided collectively by the musicgen discord community. thanks to vanya, mj, hoenn, and of course, lyra.
|
188 |
-
|
189 |
-
|
190 |
"""
|
191 |
|
192 |
# Create the Gradio interface
|
@@ -195,17 +197,17 @@ with gr.Blocks() as iface:
|
|
195 |
gr.Markdown("two ai's jamming. warning: outputs will be very strange, likely stupid, and possibly rad.")
|
196 |
gr.Markdown("this is a musical slot machine. using musiclang, we get a midi output. then, we let a musicgen model continue, semi-randomly, from different sections of the midi track. the slot machine combines em all at the end into something very bizarre. pick a number for the seed between 1 and 10k, or leave it blank to unlock the full rnjesus powers. if you wanna be lame, you can control the chord progression, prompt duration, musicgen model, number of iterations, and BPM.")
|
197 |
|
198 |
-
with gr.Accordion("
|
199 |
gr.Markdown(musiclang_blurb)
|
200 |
gr.Markdown(musicgen_blurb)
|
201 |
gr.Markdown(finetunes_blurb)
|
202 |
|
203 |
with gr.Row():
|
204 |
with gr.Column():
|
205 |
-
seed = gr.Textbox(label="
|
206 |
-
use_chords = gr.Checkbox(label="
|
207 |
-
chord_progression = gr.Textbox(label="
|
208 |
-
prompt_duration = gr.Dropdown(label="
|
209 |
musicgen_models = [
|
210 |
"thepatch/vanya_ai_dnb_0.1 (small)",
|
211 |
"thepatch/budots_remix (small)",
|
@@ -214,12 +216,12 @@ with gr.Blocks() as iface:
|
|
214 |
"thepatch/hoenn_lofi (large)"
|
215 |
]
|
216 |
|
217 |
-
musicgen_model = gr.Dropdown(label="
|
218 |
-
num_iterations = gr.Slider(label="
|
219 |
bpm = gr.Slider(label="BPM", minimum=60, maximum=200, step=1, value=140)
|
220 |
-
generate_button = gr.Button("
|
221 |
with gr.Column():
|
222 |
-
output_audio = gr.Audio(label="
|
223 |
|
224 |
generate_button.click(generate_music, inputs=[seed, use_chords, chord_progression, prompt_duration, musicgen_model, num_iterations, bpm], outputs=output_audio)
|
225 |
|
|
|
170 |
|
171 |
# Define the expandable sections
|
172 |
musiclang_blurb = """
|
173 |
+
## musiclang
|
174 |
+
musiclang is a controllable ai midi model. it can generate midi sequences based on user-provided parameters, or unconditionally.
|
175 |
+
[<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" style="vertical-align:middle"> musiclang github](https://github.com/MusicLang/musiclang_predict)
|
176 |
+
[<img src="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" alt="Hugging Face" width="20" style="vertical-align:middle"> musiclang huggingface space](https://huggingface.co/spaces/musiclang/musiclang-predict)
|
177 |
"""
|
178 |
|
179 |
musicgen_blurb = """
|
180 |
## musicgen
|
181 |
musicgen is a transformer-based music model that generates audio. It can also do something called a continuation, which was initially meant to extend musicgen outputs beyond 30 seconds. it can be used with any input audio to produce surprising results.
|
182 |
+
[<img src="https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png" alt="GitHub" width="20" style="vertical-align:middle"> musicGen github](https://github.com/facebookresearch/audiocraft)
|
183 |
+
visit https://thecollabagepatch.com/infinitepolo.mp3 or https://thecollabagepatch.com/audiocraft.mp3 to hear continuations in action.
|
184 |
+
see also https://youtube.com/@thecollabagepatch
|
185 |
"""
|
186 |
|
187 |
finetunes_blurb = """
|
188 |
+
## fine-tuned models
|
189 |
the fine-tunes hosted on the huggingface hub are provided collectively by the musicgen discord community. thanks to vanya, mj, hoenn, and of course, lyra.
|
190 |
+
[<img src="https://cdn.iconscout.com/icon/free/png-256/discord-3691244-3073764.png" alt="Discord" width="20" style="vertical-align:middle"> musicgen discord](https://discord.gg/93kX8rGZ)
|
191 |
+
[<img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab" style="vertical-align:middle"> fine-tuning colab notebook by lyra](https://colab.research.google.com/drive/13tbcC3A42KlaUZ21qvUXd25SFLu8WIvb)
|
192 |
"""
|
193 |
|
194 |
# Create the Gradio interface
|
|
|
197 |
gr.Markdown("two ai's jamming. warning: outputs will be very strange, likely stupid, and possibly rad.")
|
198 |
gr.Markdown("this is a musical slot machine. using musiclang, we get a midi output. then, we let a musicgen model continue, semi-randomly, from different sections of the midi track. the slot machine combines em all at the end into something very bizarre. pick a number for the seed between 1 and 10k, or leave it blank to unlock the full rnjesus powers. if you wanna be lame, you can control the chord progression, prompt duration, musicgen model, number of iterations, and BPM.")
|
199 |
|
200 |
+
with gr.Accordion("more info", open=False):
|
201 |
gr.Markdown(musiclang_blurb)
|
202 |
gr.Markdown(musicgen_blurb)
|
203 |
gr.Markdown(finetunes_blurb)
|
204 |
|
205 |
with gr.Row():
|
206 |
with gr.Column():
|
207 |
+
seed = gr.Textbox(label="seed (leave blank for random)", value="")
|
208 |
+
use_chords = gr.Checkbox(label="control chord progression", value=False)
|
209 |
+
chord_progression = gr.Textbox(label="chord progression (e.g., Am CM Dm E7 Am)", visible=True)
|
210 |
+
prompt_duration = gr.Dropdown(label="prompt duration (seconds)", choices=list(range(1, 11)), value=7)
|
211 |
musicgen_models = [
|
212 |
"thepatch/vanya_ai_dnb_0.1 (small)",
|
213 |
"thepatch/budots_remix (small)",
|
|
|
216 |
"thepatch/hoenn_lofi (large)"
|
217 |
]
|
218 |
|
219 |
+
musicgen_model = gr.Dropdown(label="musicGen model", choices=musicgen_models, value=musicgen_models[0])
|
220 |
+
num_iterations = gr.Slider(label="number of iterations", minimum=1, maximum=10, step=1, value=3)
|
221 |
bpm = gr.Slider(label="BPM", minimum=60, maximum=200, step=1, value=140)
|
222 |
+
generate_button = gr.Button("generate music")
|
223 |
with gr.Column():
|
224 |
+
output_audio = gr.Audio(label="your track")
|
225 |
|
226 |
generate_button.click(generate_music, inputs=[seed, use_chords, chord_progression, prompt_duration, musicgen_model, num_iterations, bpm], outputs=output_audio)
|
227 |
|