Update index.js
Browse files
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
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
|
|
|
|
|
|
| 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 |
/**
|