Spaces:
Runtime error
Runtime error
Commit
·
12a22f4
1
Parent(s):
d9d18b0
Update app.py
Browse files
app.py
CHANGED
|
@@ -6,11 +6,10 @@
|
|
| 6 |
|
| 7 |
# Updated to account for UI changes from https://github.com/rkfg/audiocraft/blob/long/app.py
|
| 8 |
# also released under the MIT license.
|
| 9 |
-
|
| 10 |
-
command = "pip install --upgrade pip; pip3 install --trusted-host pypi.python.org --no-cache-dir -r req.txt"
|
| 11 |
-
os.system(command)
|
| 12 |
import argparse
|
| 13 |
from concurrent.futures import ProcessPoolExecutor
|
|
|
|
| 14 |
from pathlib import Path
|
| 15 |
import subprocess as sp
|
| 16 |
from tempfile import NamedTemporaryFile
|
|
@@ -252,28 +251,23 @@ def ui_full(launch_kwargs):
|
|
| 252 |
gr.Markdown(
|
| 253 |
"""
|
| 254 |
### More details
|
| 255 |
-
|
| 256 |
The model will generate a short music extract based on the description you provided.
|
| 257 |
The model can generate up to 30 seconds of audio in one pass. It is now possible
|
| 258 |
to extend the generation by feeding back the end of the previous chunk of audio.
|
| 259 |
This can take a long time, and the model might lose consistency. The model might also
|
| 260 |
decide at arbitrary positions that the song ends.
|
| 261 |
-
|
| 262 |
**WARNING:** Choosing long durations will take a long time to generate (2min might take ~10min).
|
| 263 |
An overlap of 12 seconds is kept with the previously generated chunk, and 18 "new" seconds
|
| 264 |
are generated each time.
|
| 265 |
-
|
| 266 |
We present 4 model variations:
|
| 267 |
1. Melody -- a music generation model capable of generating music condition
|
| 268 |
on text and melody inputs. **Note**, you can also use text only.
|
| 269 |
2. Small -- a 300M transformer decoder conditioned on text only.
|
| 270 |
3. Medium -- a 1.5B transformer decoder conditioned on text only.
|
| 271 |
4. Large -- a 3.3B transformer decoder conditioned on text only (might OOM for the longest sequences.)
|
| 272 |
-
|
| 273 |
When using `melody`, ou can optionaly provide a reference audio from
|
| 274 |
which a broad melody will be extracted. The model will then try to follow both
|
| 275 |
the description and melody provided.
|
| 276 |
-
|
| 277 |
You can also use your own GPU or a Google Colab by following the instructions on our repo.
|
| 278 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
| 279 |
for more details.
|
|
@@ -288,7 +282,6 @@ def ui_batched(launch_kwargs):
|
|
| 288 |
gr.Markdown(
|
| 289 |
"""
|
| 290 |
# MusicGen
|
| 291 |
-
|
| 292 |
This is the demo for [MusicGen](https://github.com/facebookresearch/audiocraft),
|
| 293 |
a simple and controllable model for music generation
|
| 294 |
presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284).
|
|
@@ -345,14 +338,11 @@ def ui_batched(launch_kwargs):
|
|
| 345 |
)
|
| 346 |
gr.Markdown("""
|
| 347 |
### More details
|
| 348 |
-
|
| 349 |
The model will generate 12 seconds of audio based on the description you provided.
|
| 350 |
You can optionaly provide a reference audio from which a broad melody will be extracted.
|
| 351 |
The model will then try to follow both the description and melody provided.
|
| 352 |
All samples are generated with the `melody` model.
|
| 353 |
-
|
| 354 |
You can also use your own GPU or a Google Colab by following the instructions on our repo.
|
| 355 |
-
|
| 356 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
| 357 |
for more details.
|
| 358 |
""")
|
|
@@ -405,4 +395,4 @@ if __name__ == "__main__":
|
|
| 405 |
if IS_BATCHED:
|
| 406 |
ui_batched(launch_kwargs)
|
| 407 |
else:
|
| 408 |
-
ui_full(launch_kwargs)
|
|
|
|
| 6 |
|
| 7 |
# Updated to account for UI changes from https://github.com/rkfg/audiocraft/blob/long/app.py
|
| 8 |
# also released under the MIT license.
|
| 9 |
+
|
|
|
|
|
|
|
| 10 |
import argparse
|
| 11 |
from concurrent.futures import ProcessPoolExecutor
|
| 12 |
+
import os
|
| 13 |
from pathlib import Path
|
| 14 |
import subprocess as sp
|
| 15 |
from tempfile import NamedTemporaryFile
|
|
|
|
| 251 |
gr.Markdown(
|
| 252 |
"""
|
| 253 |
### More details
|
|
|
|
| 254 |
The model will generate a short music extract based on the description you provided.
|
| 255 |
The model can generate up to 30 seconds of audio in one pass. It is now possible
|
| 256 |
to extend the generation by feeding back the end of the previous chunk of audio.
|
| 257 |
This can take a long time, and the model might lose consistency. The model might also
|
| 258 |
decide at arbitrary positions that the song ends.
|
|
|
|
| 259 |
**WARNING:** Choosing long durations will take a long time to generate (2min might take ~10min).
|
| 260 |
An overlap of 12 seconds is kept with the previously generated chunk, and 18 "new" seconds
|
| 261 |
are generated each time.
|
|
|
|
| 262 |
We present 4 model variations:
|
| 263 |
1. Melody -- a music generation model capable of generating music condition
|
| 264 |
on text and melody inputs. **Note**, you can also use text only.
|
| 265 |
2. Small -- a 300M transformer decoder conditioned on text only.
|
| 266 |
3. Medium -- a 1.5B transformer decoder conditioned on text only.
|
| 267 |
4. Large -- a 3.3B transformer decoder conditioned on text only (might OOM for the longest sequences.)
|
|
|
|
| 268 |
When using `melody`, ou can optionaly provide a reference audio from
|
| 269 |
which a broad melody will be extracted. The model will then try to follow both
|
| 270 |
the description and melody provided.
|
|
|
|
| 271 |
You can also use your own GPU or a Google Colab by following the instructions on our repo.
|
| 272 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
| 273 |
for more details.
|
|
|
|
| 282 |
gr.Markdown(
|
| 283 |
"""
|
| 284 |
# MusicGen
|
|
|
|
| 285 |
This is the demo for [MusicGen](https://github.com/facebookresearch/audiocraft),
|
| 286 |
a simple and controllable model for music generation
|
| 287 |
presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284).
|
|
|
|
| 338 |
)
|
| 339 |
gr.Markdown("""
|
| 340 |
### More details
|
|
|
|
| 341 |
The model will generate 12 seconds of audio based on the description you provided.
|
| 342 |
You can optionaly provide a reference audio from which a broad melody will be extracted.
|
| 343 |
The model will then try to follow both the description and melody provided.
|
| 344 |
All samples are generated with the `melody` model.
|
|
|
|
| 345 |
You can also use your own GPU or a Google Colab by following the instructions on our repo.
|
|
|
|
| 346 |
See [github.com/facebookresearch/audiocraft](https://github.com/facebookresearch/audiocraft)
|
| 347 |
for more details.
|
| 348 |
""")
|
|
|
|
| 395 |
if IS_BATCHED:
|
| 396 |
ui_batched(launch_kwargs)
|
| 397 |
else:
|
| 398 |
+
ui_full(launch_kwargs)
|