tylermullen commited on
Commit
66d0e91
·
verified ·
1 Parent(s): 100ce9e

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +7 -6
index.js CHANGED
@@ -170,11 +170,11 @@ async function pipeStreamAndReportProgress(readableStream, writableStream) {
170
  }
171
 
172
  /**
173
- * For Safari, the user must upload the model manually.
174
  */
175
- async function loadLlmSafari() {
176
- alert('Safari browser does not support automatic model downloading. However, you can try downloading the model manually and then selecting it from the file chooser.');
177
- loaderMessage.textContent = "Safari not 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,8 +197,9 @@ async function loadLlmSafari() {
197
  */
198
  async function loadLlm() {
199
  const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
200
- if (isSafari) return loadLlmSafari();
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 {