tylermullen commited on
Commit
5da7d77
·
verified ·
1 Parent(s): fc7f03a

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +8 -5
index.js CHANGED
@@ -175,12 +175,15 @@ async function pipeStreamAndReportProgress(readableStream, writableStream) {
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 files = await window.showOpenFilePicker();
179
- if (files && files[0]) {
180
- const file = await files[0].getFile();
181
- const fileReader = file.stream().getReader();
182
- await initLlm(fileReader);
 
 
183
  }
 
184
  }
185
 
186
  /**
 
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 fileChooser = document.createElement('input');
179
+ fileChooser.type = 'file';
180
+ fileChooser.onchange = (e) => {
181
+ if (e.target.files && e.target.files[0]) {
182
+ const fileReader = e.target.files[0].stream().getReader();
183
+ await initLlm(fileReader);
184
+ }
185
  }
186
+ fileChooser.click();
187
  }
188
 
189
  /**