chnk58hoang commited on
Commit
21d1ad5
1 Parent(s): d83e804

add time logging

Browse files
Files changed (1) hide show
  1. app.py +7 -0
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import gradio as gr
2
  import numpy as np
3
  from utils import load_model, normalize_text
 
4
 
5
  vits = load_model()
6
 
@@ -14,7 +15,13 @@ def text_to_speech(text):
14
  dtype=np.int64,
15
  )[None, :]
16
 
 
17
  audio = vits.inference_onnx(text_inputs)
 
 
 
 
 
18
  return 16000, audio[0]
19
 
20
 
 
1
  import gradio as gr
2
  import numpy as np
3
  from utils import load_model, normalize_text
4
+ import time
5
 
6
  vits = load_model()
7
 
 
15
  dtype=np.int64,
16
  )[None, :]
17
 
18
+ start = time.perf_counter()
19
  audio = vits.inference_onnx(text_inputs)
20
+ end = time.perf_counter()
21
+ inference_time = end - start
22
+ audio_length = audio.shape[1] / vits.config.audio.sample_rate
23
+ print('Inference time: {}'.format(inference_time))
24
+ print('Real time factor: {}'.format(inference_time / audio_length))
25
  return 16000, audio[0]
26
 
27