sanchit-gandhi HF staff commited on
Commit
16e998b
1 Parent(s): d28090c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -8,7 +8,7 @@ processor = AutoProcessor.from_pretrained("facebook/musicgen-small")
8
  device = "cuda:0"
9
  model.to(device)
10
 
11
- sample_rate = model.audio_encoder.config.sample_rate
12
 
13
 
14
  def generate_audio(prompt, negative_prompt, guidance_scale=3, seed=0):
@@ -25,7 +25,7 @@ def generate_audio(prompt, negative_prompt, guidance_scale=3, seed=0):
25
  audio_values = model.generate(inputs.input_ids[0][None, :], attention_mask=inputs.attention_mask, encoder_outputs=encoder_outputs, do_sample=True, guidance_scale=guidance_scale, max_new_tokens=1028)
26
 
27
  audio_values = (audio_values.cpu().numpy() * 32767).astype(np.int16)
28
- return (sample_rate, audio_values)
29
 
30
 
31
  gr.Interface(
 
8
  device = "cuda:0"
9
  model.to(device)
10
 
11
+ sampling_rate = model.audio_encoder.config.sampling_rate
12
 
13
 
14
  def generate_audio(prompt, negative_prompt, guidance_scale=3, seed=0):
 
25
  audio_values = model.generate(inputs.input_ids[0][None, :], attention_mask=inputs.attention_mask, encoder_outputs=encoder_outputs, do_sample=True, guidance_scale=guidance_scale, max_new_tokens=1028)
26
 
27
  audio_values = (audio_values.cpu().numpy() * 32767).astype(np.int16)
28
+ return (sampling_rate, audio_values)
29
 
30
 
31
  gr.Interface(