Akjava commited on
Commit
5d2461b
1 Parent(s): 1d88bdc

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +16 -1
index.html CHANGED
@@ -28,10 +28,13 @@
28
  let matcha_tts_raw
29
  let cmudict ={}
30
  let speaking = false
 
 
31
  async function main() {
32
  if (speaking){
33
  console.log("speaking return")
34
  }
 
35
  speaking = true
36
  console.log("main called")
37
  if(!matcha_tts_raw){
@@ -63,12 +66,23 @@
63
 
64
  if (result!=null){
65
  console.timeEnd("infer");
 
 
 
 
 
66
  webWavPlay(result)
 
67
 
68
  }
69
 
70
  speaking = false
71
  }
 
 
 
 
 
72
  function update_range(){
73
  const value = document.getElementById('spks').value
74
  let formattedNumber = value.toString().padStart(3, '0');
@@ -95,7 +109,8 @@
95
 
96
 
97
  </script>
98
-
 
99
  <input type="text" id="textInput" value ="Hello Huggingface." placeholder="Enter some text here...">
100
 
101
  <button id="myButton">Text To Speak</button><br>
 
28
  let matcha_tts_raw
29
  let cmudict ={}
30
  let speaking = false
31
+ let total_infer_time=0
32
+ let count_infer=0
33
  async function main() {
34
  if (speaking){
35
  console.log("speaking return")
36
  }
37
+ const startTime = performance.now();
38
  speaking = true
39
  console.log("main called")
40
  if(!matcha_tts_raw){
 
66
 
67
  if (result!=null){
68
  console.timeEnd("infer");
69
+ const endTime = performance.now();
70
+ const infer_time = endTime-startTime
71
+ total_infer_time+=infer_time
72
+ count_infer += 1
73
+ update_infer_bench1()
74
  webWavPlay(result)
75
+
76
 
77
  }
78
 
79
  speaking = false
80
  }
81
+ function update_infer_bench1(){
82
+ const avg = a.toFixedtotal_infer_time/count_infer
83
+ const text = `Infer Count ${count_infer} avg infer-time ${avg.toFixed(2) ms}`);
84
+ document.getElementById('result').innerText=text
85
+ }
86
  function update_range(){
87
  const value = document.getElementById('spks').value
88
  let formattedNumber = value.toString().padStart(3, '0');
 
109
 
110
 
111
  </script>
112
+ <div id="result"></div>
113
+ <br><br>
114
  <input type="text" id="textInput" value ="Hello Huggingface." placeholder="Enter some text here...">
115
 
116
  <button id="myButton">Text To Speak</button><br>