File size: 5,333 Bytes
2e110de
aa6fe65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2e110de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Run Qwen 4 locally in your browser with WebGPU."
/>
<style>html{background:#000}.hero:not([data-ready]){visibility:hidden;opacity:0}</style>
<title>Qwen 4 WebGPU</title>
<link rel="icon" href="./assets/qwen.svg" />
<link
rel="preload"
as="font"
type="font/woff2"
href="./assets/geist.woff2"
crossorigin
/>
<link rel="stylesheet" href="./_shared/chat-page.css" />
<link rel="stylesheet" href="./style.css" />
<link rel="stylesheet" href="./model-panel.css" />
<link rel="stylesheet" href="./chat.css" />
</head>
<body>
<main class="hero" aria-labelledby="crystal-title">
<div class="visual" aria-hidden="true">
<canvas id="scene"></canvas>
</div>
<section inert id="model-panel" aria-labelledby="crystal-title">
<h1 id="crystal-title">
<img
src="./assets/flare-wordmark.svg"
alt="Qwen 4"
width="1000"
height="263"
/>
<canvas id="title-flare" aria-hidden="true"></canvas>
</h1>
<p class="model-intro">
Run Qwen 4 locally in your browser with WebGPU.
</p>
<div class="model-controls">
<div id="model-selection">
<div class="model-labels">
<label for="model-quant">Model</label>
<button type="button" id="addons-open" aria-haspopup="dialog">
Add-ons
</button>
</div>
<div class="model-select-wrap">
<select id="model-quant" aria-describedby="model-size"></select>
<svg viewBox="0 0 16 16" aria-hidden="true">
<path d="m4 6 4 4 4-4" />
</svg>
</div>
<div class="model-action-row">
<button type="button" id="model-load">
Load model
<span id="model-size"></span>
</button>
</div>
<p class="model-note" id="model-note" role="status" hidden></p>
</div>
<div id="model-transfer" hidden>
<div class="transfer-heading">
<span id="transfer-phase" role="status"></span>
<span id="transfer-value"></span>
<button
type="button"
id="transfer-back"
aria-label="Cancel loading"
title="Cancel loading"
>
<svg
aria-hidden="true"
width="14"
height="14"
viewBox="0 0 16 16"
fill="none"
stroke="currentColor"
stroke-width="1.5"
>
<path d="m4 4 8 8m0-8-8 8" />
</svg>
</button>
</div>
<div
class="transfer-meter"
role="progressbar"
aria-label="Model loading"
aria-valuemin="0"
aria-valuemax="100"
>
<span></span>
</div>
</div>
</div>
</section>
</main>
<section id="chat" aria-label="Chat with Qwen 4" hidden>
<header class="chat-head">
<div class="chat-head-inner">
<div class="chat-brand">
<img src="./assets/qwen.svg" alt="" width="22" height="22" />
<span class="chat-model">Qwen4-35B-A3B</span>
<span class="chat-quant" id="chat-quant"></span>
</div>
<div class="status" id="status">
<span class="status-dot"></span>
<span class="status-text" id="statusText">Ready · on-device</span>
</div>
<div class="chat-head-actions">
<button class="head-btn" id="kernelsBtn" type="button">Kernels</button>
<button class="head-btn" id="clearBtn" type="button" disabled>New chat</button>
</div>
</div>
</header>
<div class="thread-scroll" id="threadScroll">
<div class="thread" id="thread"></div>
</div>
<footer class="composer-wrap">
<div class="composer" id="composer">
<div class="attachments" id="attachments" hidden></div>
<div class="field">
<button class="icon-button attach-button" id="attachBtn" type="button" aria-label="Attach images" title="Attach images (or paste / drop them)" disabled>
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="4" width="18" height="16" rx="2.5" /><circle cx="9" cy="10" r="1.8" /><path d="m21 16-5.2-5.2a1.5 1.5 0 0 0-2.1 0L5 19.5" /></svg>
</button>
<textarea id="input" rows="1" placeholder="Loading…" disabled></textarea>
<button class="think-toggle" id="thinkBtn" type="button" aria-pressed="true" title="Reason before answering" disabled>Think</button>
<button class="icon-button send-button" id="sendBtn" type="button" disabled aria-label="Send message">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h14" /><path d="m13 6 6 6-6 6" /></svg>
</button>
<button class="icon-button stop-button" id="stopBtn" type="button" aria-label="Stop generation">
<svg viewBox="0 0 24 24" fill="currentColor"><rect x="7" y="7" width="10" height="10" rx="1.5" /></svg>
</button>
</div>
<input id="fileInput" type="file" accept="image/*" multiple hidden />
<div class="composer-meta">
<span id="hint">Runs fully on-device — prompts and images never leave your machine</span>
<span id="liveStat"></span>
</div>
</div>
</footer>
</section>
<dialog id="addons" aria-labelledby="addons-title">
<div class="dialog-head">
<span class="dialog-kicker">Qwen4-35B-A3B</span>
<button id="addons-close" class="close" aria-label="Close add-ons">
×
</button>
</div>
<h2 id="addons-title">Model add-ons</h2>
<div class="model-labels">
<label for="model-projector">Vision projector</label>
</div>
<div class="model-select-wrap">
<select id="model-projector"></select>
<svg viewBox="0 0 16 16" aria-hidden="true">
<path d="m4 6 4 4 4-4" />
</svg>
</div>
<div class="model-action-row">
<button type="button" id="addons-done">Done</button>
<span id="addons-total"></span>
</div>
</dialog>
<script type="module" src="./app.js"></script>
</body>
</html>