sanchit-gandhi HF staff commited on
Commit
a0646fa
1 Parent(s): 29309b0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -176,7 +176,7 @@ max_range = np.iinfo(target_dtype).max
176
 
177
 
178
  @spaces.GPU
179
- def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0):
180
  max_new_tokens = int(frame_rate * audio_length_in_s)
181
  play_steps = int(frame_rate * play_steps_in_s)
182
 
@@ -202,7 +202,7 @@ def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0):
202
  thread = Thread(target=model.generate, kwargs=generation_kwargs)
203
  thread.start()
204
 
205
- set_seed(0)
206
  for new_audio in streamer:
207
  print(f"Sample of length: {round(new_audio.shape[0] / sampling_rate, 2)} seconds")
208
  new_audio = (new_audio * max_range).astype(np.int16)
@@ -230,6 +230,7 @@ demo = gr.Interface(
230
  title=title,
231
  description=description,
232
  article=article,
 
233
  )
234
 
235
 
 
176
 
177
 
178
  @spaces.GPU
179
+ def generate_audio(text_prompt, audio_length_in_s=10.0, play_steps_in_s=2.0, seed=0):
180
  max_new_tokens = int(frame_rate * audio_length_in_s)
181
  play_steps = int(frame_rate * play_steps_in_s)
182
 
 
202
  thread = Thread(target=model.generate, kwargs=generation_kwargs)
203
  thread.start()
204
 
205
+ set_seed(seed)
206
  for new_audio in streamer:
207
  print(f"Sample of length: {round(new_audio.shape[0] / sampling_rate, 2)} seconds")
208
  new_audio = (new_audio * max_range).astype(np.int16)
 
230
  title=title,
231
  description=description,
232
  article=article,
233
+ cache_examples=False,
234
  )
235
 
236