Spaces:
Running
Running
Update index.js
Browse files
index.js
CHANGED
|
@@ -170,11 +170,11 @@ async function pipeStreamAndReportProgress(readableStream, writableStream) {
|
|
| 170 |
}
|
| 171 |
|
| 172 |
/**
|
| 173 |
-
* For
|
| 174 |
*/
|
| 175 |
-
async function
|
| 176 |
-
alert('
|
| 177 |
-
loaderMessage.textContent = "
|
| 178 |
const fileButton = document.getElementById('safari-upload-file-button');
|
| 179 |
const fileChooser = document.getElementById('safari-upload-file-chooser');
|
| 180 |
fileChooser.style = "visibility:hidden";
|
|
@@ -197,8 +197,9 @@ async function loadLlmSafari() {
|
|
| 197 |
*/
|
| 198 |
async function loadLlm() {
|
| 199 |
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
| 200 |
-
|
| 201 |
-
|
|
|
|
| 202 |
let opfs = await navigator.storage.getDirectory();
|
| 203 |
// If we can load the model from cache, then do so.
|
| 204 |
try {
|
|
|
|
| 170 |
}
|
| 171 |
|
| 172 |
/**
|
| 173 |
+
* For non-Chromium browsers, the user must upload the model manually.
|
| 174 |
*/
|
| 175 |
+
async function loadLlmNonChromium() {
|
| 176 |
+
alert('Your browser does not support automatic model downloading. Please run demo on Chrome, or you can try downloading the model manually and then selecting it from the file chooser.');
|
| 177 |
+
loaderMessage.textContent = "Non-Chrome browsers are not fully supported. You can try downloading the model yourself manually, and then selecting it from the file chooser.";
|
| 178 |
const fileButton = document.getElementById('safari-upload-file-button');
|
| 179 |
const fileChooser = document.getElementById('safari-upload-file-chooser');
|
| 180 |
fileChooser.style = "visibility:hidden";
|
|
|
|
| 197 |
*/
|
| 198 |
async function loadLlm() {
|
| 199 |
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
| 200 |
+
const isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
|
| 201 |
+
if (isSafari || isFirefox) return loadLlmNonChromium();
|
| 202 |
+
|
| 203 |
let opfs = await navigator.storage.getDirectory();
|
| 204 |
// If we can load the model from cache, then do so.
|
| 205 |
try {
|