Akjava commited on
Commit
3ef7bcd
1 Parent(s): d1ceb3d

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +21 -5
index.html CHANGED
@@ -30,6 +30,8 @@
30
  let speaking = false
31
  let total_infer_time=0
32
  let count_infer=0
 
 
33
  async function main(model_name) {
34
  if (typeof model_name !== 'string') {//via button click
35
  model_name ="en001_ep6399_univ_simplify"
@@ -44,6 +46,7 @@
44
  speaking = true
45
  console.log("main called")
46
  if(!matcha_tts_raw){
 
47
  matcha_tts_raw = new MatchaTTSRaw()
48
  console.time("load model");
49
  const model_path = `./models/matcha-tts/${model_name}.onnx`
@@ -51,10 +54,15 @@
51
  await matcha_tts_raw.load_model(model_path,{ executionProviders: ['webgpu','wasm'] });
52
 
53
  console.timeEnd("load model");
54
-
 
 
 
55
  let cmudictReady = loadCmudict(cmudict,'./dictionaries/cmudict-0.7b')
56
  await cmudictReady
57
 
 
 
58
  }else{
59
  console.log("session exist skip load model")
60
  }
@@ -79,7 +87,7 @@
79
  const infer_time = endTime-startTime
80
  total_infer_time+=infer_time
81
  count_infer += 1
82
- update_infer_bench1()
83
  webWavPlay(result)
84
 
85
 
@@ -88,9 +96,15 @@
88
  speaking = false
89
  }
90
  function update_infer_bench1(){
 
 
 
 
 
 
91
  const avg = total_infer_time/count_infer
92
  const text = `Infer Count ${count_infer} avg infer-time ${avg.toFixed(2)} ms`;
93
- document.getElementById('result').innerText=text
94
  }
95
  function update_range(){
96
  const value = document.getElementById('spks').value
@@ -143,9 +157,11 @@
143
  document.getElementById('buttons').appendChild(create_button("en001","en001_ep6399_univ_simplify"))
144
  document.getElementById('buttons').appendChild(create_button("en001-quantized","en001_ep6399_univ_simplify_q8"))
145
  </script>
 
 
146
   <div id="buttons"></div>
147
-
148
- <div id="result"></div>
149
  <br><br>
150
  <input type="text" id="textInput" value ="Hello Huggingface." placeholder="Enter some text here...">
151
 
 
30
  let speaking = false
31
  let total_infer_time=0
32
  let count_infer=0
33
+ let loaded_model_name
34
+ let load_time
35
  async function main(model_name) {
36
  if (typeof model_name !== 'string') {//via button click
37
  model_name ="en001_ep6399_univ_simplify"
 
46
  speaking = true
47
  console.log("main called")
48
  if(!matcha_tts_raw){
49
+ const load_startTime = performance.now();
50
  matcha_tts_raw = new MatchaTTSRaw()
51
  console.time("load model");
52
  const model_path = `./models/matcha-tts/${model_name}.onnx`
 
54
  await matcha_tts_raw.load_model(model_path,{ executionProviders: ['webgpu','wasm'] });
55
 
56
  console.timeEnd("load model");
57
+
58
+ load_time = load_startTime - performance.now()
59
+ loaded_model_name = model_name
60
+
61
  let cmudictReady = loadCmudict(cmudict,'./dictionaries/cmudict-0.7b')
62
  await cmudictReady
63
 
64
+
65
+ update_infer_bench2()
66
  }else{
67
  console.log("session exist skip load model")
68
  }
 
87
  const infer_time = endTime-startTime
88
  total_infer_time+=infer_time
89
  count_infer += 1
90
+ update_infer_bench2()
91
  webWavPlay(result)
92
 
93
 
 
96
  speaking = false
97
  }
98
  function update_infer_bench1(){
99
+
100
+ const text = `${loaded_model_name} load time ${load_time.toFixed(2)} ms`;
101
+ document.getElementById('result2').innerText=text
102
+ }
103
+
104
+ function update_infer_bench2(){
105
  const avg = total_infer_time/count_infer
106
  const text = `Infer Count ${count_infer} avg infer-time ${avg.toFixed(2)} ms`;
107
+ document.getElementById('result2').innerText=text
108
  }
109
  function update_range(){
110
  const value = document.getElementById('spks').value
 
157
  document.getElementById('buttons').appendChild(create_button("en001","en001_ep6399_univ_simplify"))
158
  document.getElementById('buttons').appendChild(create_button("en001-quantized","en001_ep6399_univ_simplify_q8"))
159
  </script>
160
+ <div id="result1"></div>
161
+ <br>
162
   <div id="buttons"></div>
163
+ <br>
164
+ <div id="result2"></div>
165
  <br><br>
166
  <input type="text" id="textInput" value ="Hello Huggingface." placeholder="Enter some text here...">
167