sanchit-gandhi HF staff commited on
Commit
ea0ca2f
1 Parent(s): c17f9f9

update examples

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. app.py +8 -8
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Musicgen Streaming
3
  emoji: 🔥
4
  colorFrom: pink
5
  colorTo: gray
 
1
  ---
2
+ title: MusicGen Streaming
3
  emoji: 🔥
4
  colorFrom: pink
5
  colorTo: gray
app.py CHANGED
@@ -207,26 +207,26 @@ def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0, see
207
  for new_audio in streamer:
208
  print(f"Sample of length: {round(new_audio.shape[0] / sampling_rate, 2)} seconds")
209
  new_audio = (new_audio * max_range).astype(np.int16)
210
- yield (sampling_rate, new_audio)
211
 
212
 
213
  demo = gr.Interface(
214
  fn=generate_audio,
215
  inputs=[
216
  gr.Text(label="Prompt", value="80s pop track with synth and instrumentals"),
217
- gr.Slider(15, 30, value=20, step=5, label="Audio length in seconds"),
218
- gr.Slider(2.5, 7.5, value=5.0, step=0.5, label="Streaming interval in seconds", info="Lower = shorter chunks, lower latency, more codec steps"),
219
  gr.Slider(0, 10, value=5, step=1, label="Seed for random generations"),
220
  ],
221
  outputs=[
222
  gr.Audio(label="Generated Music", streaming=True, autoplay=True)
223
  ],
224
  examples=[
225
- ["An 80s driving pop song with heavy drums and synth pads in the background", 20, 5, 5],
226
- ["A cheerful country song with acoustic guitars", 20, 5, 5],
227
- ["90s rock song with electric guitar and heavy drums", 20, 5, 5],
228
- ["a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions bpm: 130", 30, 5, 5],
229
- ["lofi slow bpm electro chill with organic samples", 30, 5, 5],
230
  ],
231
  title=title,
232
  description=description,
 
207
  for new_audio in streamer:
208
  print(f"Sample of length: {round(new_audio.shape[0] / sampling_rate, 2)} seconds")
209
  new_audio = (new_audio * max_range).astype(np.int16)
210
+ yield sampling_rate, new_audio
211
 
212
 
213
  demo = gr.Interface(
214
  fn=generate_audio,
215
  inputs=[
216
  gr.Text(label="Prompt", value="80s pop track with synth and instrumentals"),
217
+ gr.Slider(10, 30, value=15, step=5, label="Audio length in seconds"),
218
+ gr.Slider(0.5, 2.5, value=0.5, step=0.5, label="Streaming interval in seconds", info="Lower = shorter chunks, lower latency, more codec steps"),
219
  gr.Slider(0, 10, value=5, step=1, label="Seed for random generations"),
220
  ],
221
  outputs=[
222
  gr.Audio(label="Generated Music", streaming=True, autoplay=True)
223
  ],
224
  examples=[
225
+ ["An 80s driving pop song with heavy drums and synth pads in the background", 30, 0.5, 5],
226
+ ["A cheerful country song with acoustic guitars", 30, 0.5, 5],
227
+ ["90s rock song with electric guitar and heavy drums", 30, 0.5, 5],
228
+ ["a light and cheerly EDM track, with syncopated drums, aery pads, and strong emotions bpm: 130", 30, 0.5, 5],
229
+ ["lofi slow bpm electro chill with organic samples", 30, 0.5, 5],
230
  ],
231
  title=title,
232
  description=description,