erogol commited on
Commit
c3816ad
1 Parent(s): eea4c7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -253,14 +253,16 @@ def predict(
253
 
254
  wav_chunks = []
255
  ## Direct mode
256
- """
257
  print("I: Generating new audio...")
258
  t0 = time.time()
259
  out = model.inference(
260
  prompt,
261
  language,
262
  gpt_cond_latent,
263
- speaker_embedding
 
 
264
  )
265
  inference_time = time.time() - t0
266
  print(f"I: Time to generate audio: {round(inference_time*1000)} milliseconds")
@@ -269,8 +271,9 @@ def predict(
269
  print(f"Real-time factor (RTF): {real_time_factor}")
270
  metrics_text+=f"Real-time factor (RTF): {real_time_factor:.2f}\n"
271
  torchaudio.save("output.wav", torch.tensor(out["wav"]).unsqueeze(0), 24000)
272
- """
273
 
 
 
274
  print("I: Generating new audio in streaming mode...")
275
  t0 = time.time()
276
  chunks = model.inference_stream(
@@ -305,6 +308,7 @@ def predict(
305
  metrics_text += f"Real-time factor (RTF): {real_time_factor:.2f}\n"
306
 
307
  torchaudio.save("output.wav", wav.squeeze().unsqueeze(0).cpu(), 24000)
 
308
 
309
  except RuntimeError as e:
310
  if "device-side assert" in str(e):
 
253
 
254
  wav_chunks = []
255
  ## Direct mode
256
+
257
  print("I: Generating new audio...")
258
  t0 = time.time()
259
  out = model.inference(
260
  prompt,
261
  language,
262
  gpt_cond_latent,
263
+ speaker_embedding,
264
+ repetition_penalty=5.0,
265
+ temperature=0.75,
266
  )
267
  inference_time = time.time() - t0
268
  print(f"I: Time to generate audio: {round(inference_time*1000)} milliseconds")
 
271
  print(f"Real-time factor (RTF): {real_time_factor}")
272
  metrics_text+=f"Real-time factor (RTF): {real_time_factor:.2f}\n"
273
  torchaudio.save("output.wav", torch.tensor(out["wav"]).unsqueeze(0), 24000)
 
274
 
275
+
276
+ """
277
  print("I: Generating new audio in streaming mode...")
278
  t0 = time.time()
279
  chunks = model.inference_stream(
 
308
  metrics_text += f"Real-time factor (RTF): {real_time_factor:.2f}\n"
309
 
310
  torchaudio.save("output.wav", wav.squeeze().unsqueeze(0).cpu(), 24000)
311
+ """
312
 
313
  except RuntimeError as e:
314
  if "device-side assert" in str(e):