Spaces:
Running
Running
enable model fetching mechanism
Browse files- app/static/index.html +17 -0
app/static/index.html
CHANGED
@@ -139,6 +139,7 @@
|
|
139 |
orig_sample_rate = context.sampleRate;
|
140 |
|
141 |
ws.onopen = () => {
|
|
|
142 |
console.log("[DEBUG client] WebSocket.onopen fired!");
|
143 |
ws.send(JSON.stringify({
|
144 |
type: "config",
|
@@ -147,6 +148,22 @@
|
|
147 |
precision: precisionSelect.value
|
148 |
}));
|
149 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
150 |
ws.onerror = err => {
|
151 |
console.error("[DEBUG client] WebSocket.onerror:", err);
|
152 |
};
|
|
|
139 |
orig_sample_rate = context.sampleRate;
|
140 |
|
141 |
ws.onopen = () => {
|
142 |
+
sendConfig();
|
143 |
console.log("[DEBUG client] WebSocket.onopen fired!");
|
144 |
ws.send(JSON.stringify({
|
145 |
type: "config",
|
|
|
148 |
precision: precisionSelect.value
|
149 |
}));
|
150 |
};
|
151 |
+
|
152 |
+
// factor out sending config
|
153 |
+
function sendConfig() {
|
154 |
+
ws.send(JSON.stringify({
|
155 |
+
type: "config",
|
156 |
+
sampleRate: orig_sample_rate,
|
157 |
+
model: modelSelect.value,
|
158 |
+
precision: precisionSelect.value
|
159 |
+
}));
|
160 |
+
}
|
161 |
+
|
162 |
+
// send a new config when dropdowns change
|
163 |
+
modelSelect.addEventListener("change", sendConfig);
|
164 |
+
precisionSelect.addEventListener("change", sendConfig);
|
165 |
+
|
166 |
+
|
167 |
ws.onerror = err => {
|
168 |
console.error("[DEBUG client] WebSocket.onerror:", err);
|
169 |
};
|