RecapAnon commited on
Commit ·
6de6dbf
1
Parent(s): 489fa61
Fix browser errors: model loading, favicon, and source map warnings
Browse files- favicon.svg +4 -0
- index.html +1 -0
- index.js +12 -3
favicon.svg
ADDED
|
|
index.html
CHANGED
|
@@ -4,6 +4,7 @@
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Ask Miku</title>
|
|
|
|
| 7 |
<style>
|
| 8 |
* {
|
| 9 |
margin: 0;
|
|
|
|
| 4 |
<meta charset="UTF-8">
|
| 5 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
<title>Ask Miku</title>
|
| 7 |
+
<link rel="icon" type="image/svg+xml" href="favicon.svg">
|
| 8 |
<style>
|
| 9 |
* {
|
| 10 |
margin: 0;
|
index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import { pipeline, TextStreamer } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.6";
|
| 2 |
|
| 3 |
// DOM Elements
|
| 4 |
const chatContainer = document.getElementById('chatContainer');
|
|
@@ -17,12 +17,21 @@ let isGenerating = false;
|
|
| 17 |
// Initialize the model
|
| 18 |
async function initializeModel() {
|
| 19 |
try {
|
| 20 |
-
updateStatus('loading', 'Loading Qwen3 model...');
|
| 21 |
|
| 22 |
generator = await pipeline(
|
| 23 |
"text-generation",
|
| 24 |
"onnx-community/Qwen3-0.6B-ONNX",
|
| 25 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
);
|
| 27 |
|
| 28 |
updateStatus('ready', 'Model ready!');
|
|
|
|
| 1 |
+
import { pipeline, TextStreamer } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.6/dist/transformers.min.js";
|
| 2 |
|
| 3 |
// DOM Elements
|
| 4 |
const chatContainer = document.getElementById('chatContainer');
|
|
|
|
| 17 |
// Initialize the model
|
| 18 |
async function initializeModel() {
|
| 19 |
try {
|
| 20 |
+
updateStatus('loading', 'Loading Qwen3 model... This may take a minute on first load.');
|
| 21 |
|
| 22 |
generator = await pipeline(
|
| 23 |
"text-generation",
|
| 24 |
"onnx-community/Qwen3-0.6B-ONNX",
|
| 25 |
+
{
|
| 26 |
+
dtype: "q4f16",
|
| 27 |
+
device: "wasm",
|
| 28 |
+
progress_callback: (progress) => {
|
| 29 |
+
if (progress.status === 'progress') {
|
| 30 |
+
const percent = Math.round((progress.loaded / progress.total) * 100);
|
| 31 |
+
updateStatus('loading', `Loading model... ${percent}%`);
|
| 32 |
+
}
|
| 33 |
+
}
|
| 34 |
+
}
|
| 35 |
);
|
| 36 |
|
| 37 |
updateStatus('ready', 'Model ready!');
|