File tree Expand file tree Collapse file tree 1 file changed +9
-0
lines changed
examples/llm_inference/hugging_face_js/gemma_3n Expand file tree Collapse file tree 1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,15 @@ async function pipeStreamAndReportProgress(readableStream, writableStream) {
183183 * Loads the LLM file from either cache or OAuth-guarded remote download.
184184 */
185185async function loadLlm ( ) {
186+ // For browsers other than Chrome and Edge, we just show an alert and error out.
187+ const isChrome = navigator . userAgent . includes ( 'Chrome' ) ;
188+ const isEdge = navigator . userAgent . includes ( 'Edg' ) ;
189+ if ( ! isChrome && ! isEdge ) {
190+ alert ( 'Non-Chromium browsers are not supported yet. Please run demo on Chrome for the best experience.' ) ;
191+ loaderMessage . textContent = "Non-Chromium browsers are not supported yet. Please run on Chrome for best experience." ;
192+ return ;
193+ }
194+
186195 let opfs = await navigator . storage . getDirectory ( ) ;
187196 // If we can load the model from cache, then do so.
188197 try {
You can’t perform that action at this time.
0 commit comments