Spaces:
Running
on
A10G
Running
on
A10G
Commit
•
60a6a17
1
Parent(s):
81c4893
Update app.py
Browse files
app.py
CHANGED
@@ -20,6 +20,8 @@ from models import MusicAudioDiffusion
|
|
20 |
|
21 |
from gradio import Markdown
|
22 |
|
|
|
|
|
23 |
class MusicFeaturePredictor:
|
24 |
def __init__(self, path, device="cuda:0", cache_dir=None, local_files_only=False):
|
25 |
self.beats_tokenizer = AutoTokenizer.from_pretrained(
|
@@ -221,7 +223,7 @@ else:
|
|
221 |
mustango = Mustango(device="cpu")
|
222 |
|
223 |
# output_wave = mustango.generate("This techno song features a synth lead playing the main melody.", 5, 3, disable_progress=False)
|
224 |
-
|
225 |
def gradio_generate(prompt, steps, guidance):
|
226 |
output_wave = mustango.generate(prompt, steps, guidance)
|
227 |
# output_filename = f"{prompt.replace(' ', '_')}_{steps}_{guidance}"[:250] + ".wav"
|
@@ -270,7 +272,7 @@ gr_interface = gr.Interface(
|
|
270 |
["This is a live performance of a classical music piece. There is an orchestra performing the piece with a violin lead playing the main melody. The atmosphere is sentimental and heart-touching. This piece could be playing in the background at a classy restaurant. The chord progression in this song is Am7, Gm, Dm, A7, Dm. The beat is 3. This song is in Largo. The key of this song is D minor.", 200, 3],
|
271 |
["This is a techno piece with drums and beats and a leading melody. A synth plays chords. The music kicks off with a powerful and relentless drumbeat. Over the pounding beats, a leading melody emerges. In the middle of the song, a flock of seagulls flies over the venue and make loud bird sounds. It has strong danceability and can be played in a club. The tempo is 120 bpm. The chords played by the synth are Am, Cm, Dm, Gm.", 200, 3],
|
272 |
],
|
273 |
-
cache_examples=
|
274 |
)
|
275 |
|
276 |
with gr.Blocks(css=css) as demo:
|
|
|
20 |
|
21 |
from gradio import Markdown
|
22 |
|
23 |
+
import spaces
|
24 |
+
|
25 |
class MusicFeaturePredictor:
|
26 |
def __init__(self, path, device="cuda:0", cache_dir=None, local_files_only=False):
|
27 |
self.beats_tokenizer = AutoTokenizer.from_pretrained(
|
|
|
223 |
mustango = Mustango(device="cpu")
|
224 |
|
225 |
# output_wave = mustango.generate("This techno song features a synth lead playing the main melody.", 5, 3, disable_progress=False)
|
226 |
+
@spaces.GPU(duration=120)
|
227 |
def gradio_generate(prompt, steps, guidance):
|
228 |
output_wave = mustango.generate(prompt, steps, guidance)
|
229 |
# output_filename = f"{prompt.replace(' ', '_')}_{steps}_{guidance}"[:250] + ".wav"
|
|
|
272 |
["This is a live performance of a classical music piece. There is an orchestra performing the piece with a violin lead playing the main melody. The atmosphere is sentimental and heart-touching. This piece could be playing in the background at a classy restaurant. The chord progression in this song is Am7, Gm, Dm, A7, Dm. The beat is 3. This song is in Largo. The key of this song is D minor.", 200, 3],
|
273 |
["This is a techno piece with drums and beats and a leading melody. A synth plays chords. The music kicks off with a powerful and relentless drumbeat. Over the pounding beats, a leading melody emerges. In the middle of the song, a flock of seagulls flies over the venue and make loud bird sounds. It has strong danceability and can be played in a club. The tempo is 120 bpm. The chords played by the synth are Am, Cm, Dm, Gm.", 200, 3],
|
274 |
],
|
275 |
+
cache_examples="lazy",
|
276 |
)
|
277 |
|
278 |
with gr.Blocks(css=css) as demo:
|