Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -179,21 +179,18 @@ async function pipeStreamAndReportProgress(readableStream, writableStream) {
|
|
| 179 |
}
|
| 180 |
}
|
| 181 |
|
| 182 |
-
/**
|
| 183 |
-
* For non-Chromium browsers, the user must upload the model manually.
|
| 184 |
-
*/
|
| 185 |
-
async function loadLlmNonChromium() {
|
| 186 |
-
alert('Non-Chromium browsers are not supported yet. Please run demo on Chrome for the best experience.');
|
| 187 |
-
loaderMessage.textContent = "Non-Chromium browsers are not supported yet. Please run on Chrome for best experience.";
|
| 188 |
-
}
|
| 189 |
-
|
| 190 |
/**
|
| 191 |
* Loads the LLM file from either cache or OAuth-guarded remote download.
|
| 192 |
*/
|
| 193 |
async function loadLlm() {
|
| 194 |
-
|
| 195 |
-
const
|
| 196 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 197 |
|
| 198 |
let opfs = await navigator.storage.getDirectory();
|
| 199 |
// If we can load the model from cache, then do so.
|
|
|
|
| 179 |
}
|
| 180 |
}
|
| 181 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 182 |
/**
|
| 183 |
* Loads the LLM file from either cache or OAuth-guarded remote download.
|
| 184 |
*/
|
| 185 |
async function loadLlm() {
|
| 186 |
+
// For browsers other than Chrome and Edge, we just show an alert and error out.
|
| 187 |
+
const isChrome = navigator.userAgent.includes('Chrome');
|
| 188 |
+
const isEdge = navigator.userAgent.includes('Edg');
|
| 189 |
+
if (!isChrome && !isEdge) {
|
| 190 |
+
alert('Non-Chromium browsers are not supported yet. Please run demo on Chrome for the best experience.');
|
| 191 |
+
loaderMessage.textContent = "Non-Chromium browsers are not supported yet. Please run on Chrome for best experience.";
|
| 192 |
+
return;
|
| 193 |
+
}
|
| 194 |
|
| 195 |
let opfs = await navigator.storage.getDirectory();
|
| 196 |
// If we can load the model from cache, then do so.
|