radames commited on
Commit
930d4a2
1 Parent(s): 1aacea1

Upload 2 files

Browse files
Files changed (2) hide show
  1. bertWorker.js +2 -2
  2. index.html +6 -3
bertWorker.js CHANGED
@@ -34,7 +34,7 @@ class Bert {
34
  mel_filtersArrayU8
35
  );
36
  } else {
37
- self.postMessage({ status: "loading", message: "Model Already Loaded" });
38
  }
39
  return this.instance[modelID];
40
  }
@@ -50,7 +50,7 @@ self.addEventListener("message", async (event) => {
50
  normalize = true,
51
  } = event.data;
52
  try {
53
- self.postMessage({ status: "loading", message: "Starting Bert Model" });
54
  const model = await Bert.getInstance(
55
  weightsURL,
56
  tokenizerURL,
 
34
  mel_filtersArrayU8
35
  );
36
  } else {
37
+ self.postMessage({ status: "ready", message: "Model Already Loaded" });
38
  }
39
  return this.instance[modelID];
40
  }
 
50
  normalize = true,
51
  } = event.data;
52
  try {
53
+ self.postMessage({ status: "ready", message: "Starting Bert Model" });
54
  const model = await Bert.getInstance(
55
  weightsURL,
56
  tokenizerURL,
index.html CHANGED
@@ -175,7 +175,8 @@
175
  tokenizerURL,
176
  configURL,
177
  modelID,
178
- [query]
 
179
  );
180
  allEmbeddings.push(embeddings);
181
  }
@@ -187,8 +188,10 @@
187
 
188
  function updateStatus(data) {
189
  if ("status" in data) {
190
- outputStatusEl.innerText = data.message;
191
- outputStatusEl.classList.remove("invisible");
 
 
192
  }
193
  }
194
  function toggleInputs(state) {
 
175
  tokenizerURL,
176
  configURL,
177
  modelID,
178
+ [query],
179
+ updateStatus
180
  );
181
  allEmbeddings.push(embeddings);
182
  }
 
188
 
189
  function updateStatus(data) {
190
  if ("status" in data) {
191
+ if (data.status === "loading") {
192
+ outputStatusEl.innerText = data.message;
193
+ outputStatusEl.classList.remove("invisible");
194
+ }
195
  }
196
  }
197
  function toggleInputs(state) {