awacke1 commited on
Commit
61db486
·
1 Parent(s): bc254e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -13
app.py CHANGED
@@ -10,20 +10,17 @@ from transformers.generation.streamers import BaseStreamer
10
 
11
  model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small")
12
  processor = MusicgenProcessor.from_pretrained("facebook/musicgen-small")
13
- title = "MusicGen Streaming"
 
14
  description = """
15
- Stream the outputs of the MusicGen text-to-music model by playing the generated audio as soon as the first chunk is ready.
16
- Demo uses [MusicGen Small](https://huggingface.co/facebook/musicgen-small) in the 🤗 Transformers library. Note that the
17
- demo works best on the Chrome browser. If there is no audio output, try switching browsers to Chrome.
18
  """
19
 
20
  article = """
21
  ## How Does It Work?
22
  MusicGen is an auto-regressive transformer-based model, meaning generates audio codes (tokens) in a causal fashion.
23
  At each decoding step, the model generates a new set of audio codes, conditional on the text input and all previous audio codes. From the
24
- frame rate of the [EnCodec model](https://huggingface.co/facebook/encodec_32khz) used to decode the generated codes to audio waveform,
25
- each set of generated audio codes corresponds to 0.02 seconds. This means we require a total of 1000 decoding steps to generate
26
- 20 seconds of audio.
27
  """
28
 
29
 
@@ -198,13 +195,15 @@ demo = gr.Interface(
198
  outputs=[
199
  gr.Audio(label="Generated Music", streaming=True, autoplay=True)
200
  ],
201
- examples=[
202
- ["An 80s driving pop song with heavy drums and synth pads in the background", 20, 0.5, 5],
203
- ["A cheerful country song with acoustic guitars", 15, 0.5, 5],
204
- ["90s rock song with electric guitar and heavy drums", 15, 0.5, 5],
205
- ["a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions bpm: 130", 30, 0.5, 5],
206
- ["lofi slow bpm electro chill with organic samples", 30, 0.5, 5],
 
207
  ],
 
208
  title=title,
209
  description=description,
210
  article=article,
 
10
 
11
  model = MusicgenForConditionalGeneration.from_pretrained("facebook/musicgen-small")
12
  processor = MusicgenProcessor.from_pretrained("facebook/musicgen-small")
13
+
14
+ title = "MusicGenStream with Facebook MusicGen-Small Model"
15
  description = """
16
+ Generate and stream music using https://huggingface.co/facebook/musicgen-small
 
 
17
  """
18
 
19
  article = """
20
  ## How Does It Work?
21
  MusicGen is an auto-regressive transformer-based model, meaning generates audio codes (tokens) in a causal fashion.
22
  At each decoding step, the model generates a new set of audio codes, conditional on the text input and all previous audio codes. From the
23
+ frame rate of the [EnCodec model](https://huggingface.co/facebook/encodec_32khz) used to decode the generated codes to audio waveform.
 
 
24
  """
25
 
26
 
 
195
  outputs=[
196
  gr.Audio(label="Generated Music", streaming=True, autoplay=True)
197
  ],
198
+ examples = [
199
+ ["Electronic Dance track with pulsating bass and high energy synths. bpm: 126", 30, 0.5, 5],
200
+ ["Rap Beats with deep bass and snappy snares. bpm: 80", 30, 0.5, 5],
201
+ ["Lo-Fi track with smooth beats and chill vibes. bpm: 100", 30, 0.5, 5],
202
+ ["Global Groove track with international instruments and dance rhythms. bpm: 128", 30, 0.5, 5],
203
+ ["Relaxing Meditation music with ambient pads and soothing melodies. bpm: 80", 30, 0.5, 5],
204
+ ["Rave Dance track with hard-hitting beats and euphoric synths. bpm: 128", 30, 0.5, 5]
205
  ],
206
+
207
  title=title,
208
  description=description,
209
  article=article,