bcci commited on
Commit
05eca7a
·
verified ·
1 Parent(s): e334297

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -1
app.py CHANGED
@@ -20,6 +20,8 @@ from huggingface_hub import snapshot_download
20
  import json
21
  from scipy.io.wavfile import write as write_wav
22
 
 
 
23
  # Load the configuration file
24
  config_file_path = 'config.json' # Update this with the path to your config file
25
 
@@ -243,16 +245,20 @@ def tts_full(text: str, voice: str = "af_heart", speed: float = 1.0, format: str
243
 
244
  final_token = [[0, *tokens, 0]]
245
 
 
 
246
  audio = sess.run(None, dict(
247
  input_ids=final_token,
248
  style=ref_s,
249
  speed=np.ones(1, dtype=np.float32),
250
  ))[0]
251
 
 
 
252
  # Write the concatenated audio to an in-memory WAV or Opus file.
253
  sample_rate = 24000
254
 
255
- audio = np.array(audio, dtype=np.float32) # Ensure it's float32 first
256
  audio = (audio * 32767).astype(np.int16) # Scale to int16 range
257
 
258
  # Flatten the array if it's 2D
 
20
  import json
21
  from scipy.io.wavfile import write as write_wav
22
 
23
+ import time
24
+
25
  # Load the configuration file
26
  config_file_path = 'config.json' # Update this with the path to your config file
27
 
 
245
 
246
  final_token = [[0, *tokens, 0]]
247
 
248
+ start_time = time.time()
249
+
250
  audio = sess.run(None, dict(
251
  input_ids=final_token,
252
  style=ref_s,
253
  speed=np.ones(1, dtype=np.float32),
254
  ))[0]
255
 
256
+ print(time.time()-start_time)
257
+
258
  # Write the concatenated audio to an in-memory WAV or Opus file.
259
  sample_rate = 24000
260
 
261
+ # audio = np.array(audio, dtype=np.float32) # Ensure it's float32 first
262
  audio = (audio * 32767).astype(np.int16) # Scale to int16 range
263
 
264
  # Flatten the array if it's 2D