sanchit-gandhi HF staff commited on
Commit
8a81f8c
1 Parent(s): 5bbcda3

remove cast to int16

Browse files
Files changed (1) hide show
  1. app.py +0 -4
app.py CHANGED
@@ -172,9 +172,6 @@ class MusicgenStreamer(BaseStreamer):
172
  sampling_rate = model.audio_encoder.config.sampling_rate
173
  frame_rate = model.audio_encoder.config.frame_rate
174
 
175
- target_dtype = np.int16
176
- max_range = np.iinfo(target_dtype).max
177
-
178
 
179
  @spaces.GPU()
180
  def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0, seed=0):
@@ -206,7 +203,6 @@ def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0, see
206
  set_seed(seed)
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
 
 
172
  sampling_rate = model.audio_encoder.config.sampling_rate
173
  frame_rate = model.audio_encoder.config.frame_rate
174
 
 
 
 
175
 
176
  @spaces.GPU()
177
  def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0, seed=0):
 
203
  set_seed(seed)
204
  for new_audio in streamer:
205
  print(f"Sample of length: {round(new_audio.shape[0] / sampling_rate, 2)} seconds")
 
206
  yield sampling_rate, new_audio
207
 
208