tylermullen commited on
Commit
79d8a2e
·
verified ·
1 Parent(s): 28b0856

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +4 -4
index.js CHANGED
@@ -175,17 +175,17 @@ 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 fileChooser = document.createElement('input');
 
179
  fileChooser.style = "visibility:hidden";
180
- fileChooser.type = 'file';
181
  fileChooser.onchange = (e) => {
182
  if (e.target.files && e.target.files[0]) {
183
  const fileReader = e.target.files[0].stream().getReader();
184
  initLlm(fileReader);
185
  }
186
  };
187
- document.body.appendChild(fileChooser);
188
- fileChooser.click();
189
  }
190
 
191
  /**
 
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-file-upload-button');
179
+ const fileChooser = document.getElementById('safari-file-upload-chooser');
180
  fileChooser.style = "visibility:hidden";
181
+ fileButton.style = "";
182
  fileChooser.onchange = (e) => {
183
  if (e.target.files && e.target.files[0]) {
184
  const fileReader = e.target.files[0].stream().getReader();
185
  initLlm(fileReader);
186
  }
187
  };
188
+ fileButton.onclick = () => { fileChooser.click(); };
 
189
  }
190
 
191
  /**