merging app from HF demo
Browse files
app.py
CHANGED
@@ -10,10 +10,12 @@ from tempfile import NamedTemporaryFile
|
|
10 |
import argparse
|
11 |
import torch
|
12 |
import gradio as gr
|
|
|
13 |
from audiocraft.models import MusicGen
|
14 |
from audiocraft.data.audio import audio_write
|
15 |
|
16 |
MODEL = None
|
|
|
17 |
|
18 |
|
19 |
def load_model(version):
|
@@ -67,15 +69,18 @@ def ui(**kwargs):
|
|
67 |
gr.Markdown(
|
68 |
"""
|
69 |
# MusicGen
|
70 |
-
|
71 |
-
|
72 |
-
presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284).
|
73 |
-
<br/>
|
74 |
-
<a href="https://huggingface.co/spaces/musicgen/MusicGen?duplicate=true" style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank">
|
75 |
-
<img style="margin-bottom: 0em;display: inline;margin-top: -.25em;" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
76 |
-
for longer sequences, more control and no queue.</p>
|
77 |
"""
|
78 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
with gr.Row():
|
80 |
with gr.Column():
|
81 |
with gr.Row():
|
@@ -173,7 +178,6 @@ def ui(**kwargs):
|
|
173 |
|
174 |
|
175 |
if __name__ == "__main__":
|
176 |
-
# torch.cuda.set_per_process_memory_fraction(0.48)
|
177 |
parser = argparse.ArgumentParser()
|
178 |
parser.add_argument(
|
179 |
'--listen',
|
|
|
10 |
import argparse
|
11 |
import torch
|
12 |
import gradio as gr
|
13 |
+
import os
|
14 |
from audiocraft.models import MusicGen
|
15 |
from audiocraft.data.audio import audio_write
|
16 |
|
17 |
MODEL = None
|
18 |
+
IS_SHARED_SPACE = "musicgen/MusicGen" in os.environ['SPACE_ID']
|
19 |
|
20 |
|
21 |
def load_model(version):
|
|
|
69 |
gr.Markdown(
|
70 |
"""
|
71 |
# MusicGen
|
72 |
+
This is your private demo for [MusicGen](https://github.com/facebookresearch/audiocraft), a simple and controllable model for music generation
|
73 |
+
presented at: ["Simple and Controllable Music Generation"](https://huggingface.co/papers/2306.05284)
|
|
|
|
|
|
|
|
|
|
|
74 |
"""
|
75 |
)
|
76 |
+
if IS_SHARED_SPACE:
|
77 |
+
gr.Markdown("""
|
78 |
+
⚠ This Space doesn't work in this shared UI ⚠
|
79 |
+
|
80 |
+
<a href="https://huggingface.co/spaces/musicgen/MusicGen?duplicate=true" style="display: inline-block;margin-top: .5em;margin-right: .25em;" target="_blank">
|
81 |
+
<img style="margin-bottom: 0em;display: inline;margin-top: -.25em;" src="https://bit.ly/3gLdBN6" alt="Duplicate Space"></a>
|
82 |
+
to use it privately, or use the <a href="https://huggingface.co/spaces/facebook/MusicGen">public demo</a>
|
83 |
+
""")
|
84 |
with gr.Row():
|
85 |
with gr.Column():
|
86 |
with gr.Row():
|
|
|
178 |
|
179 |
|
180 |
if __name__ == "__main__":
|
|
|
181 |
parser = argparse.ArgumentParser()
|
182 |
parser.add_argument(
|
183 |
'--listen',
|