Spaces:
Running

File size: 2,813 Bytes
a1fab06
f799f05
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
a1fab06
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
<!doctype html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
  <meta name="color-scheme" content="light dark" />
  <title>Qwen WebGPU Worker Test</title>
  <style>
    :root { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
    body { margin: 0; background: Canvas; color: CanvasText; }
    main { max-width: 720px; margin: 0 auto; padding: 20px; }
    h1 { font-size: 24px; margin: 0 0 8px; }
    .muted { opacity: .72; font-size: 14px; }
    .card { border: 1px solid color-mix(in srgb, CanvasText 18%, transparent); border-radius: 14px; padding: 16px; margin: 16px 0; }
    label { display: block; font-weight: 600; margin: 12px 0 6px; }
    select, textarea, button { width: 100%; box-sizing: border-box; font: inherit; }
    select, textarea { padding: 12px; border-radius: 10px; border: 1px solid color-mix(in srgb, CanvasText 22%, transparent); background: Canvas; color: CanvasText; }
    textarea { min-height: 110px; resize: vertical; }
    button { margin-top: 12px; padding: 13px 14px; border: 0; border-radius: 10px; font-weight: 700; cursor: pointer; }
    button:disabled { opacity: .45; cursor: default; }
    progress { width: 100%; height: 16px; }
    #output, #log { white-space: pre-wrap; overflow-wrap: anywhere; border-radius: 10px; padding: 12px; background: color-mix(in srgb, CanvasText 7%, Canvas); min-height: 70px; }
    #log { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 220px; overflow: auto; }
    .ok { color: #188038; }
    .err { color: #c5221f; }
  </style>
</head>
<body>
  <main>
    <h1>Qwen WebGPU Worker Test</h1>
    <p class="muted">Runs the ML pipeline in a Web Worker. Test Qwen3.5-0.8B first; if Safari reloads, retry with Qwen3-0.6B.</p>

    <section class="card">
      <label for="model">Model</label>
      <select id="model">
        <option value="qwen35-08" selected>Qwen3.5-0.8B q4f16 — first test</option>
        <option value="qwen3-06">Qwen3-0.6B q4f16 — fallback/control</option>
      </select>

      <button id="initBtn">Load selected model</button>

      <p id="status">Idle</p>
      <div id="fileName" class="muted"></div>
      <progress id="progress" value="0" max="100"></progress>
      <div id="percent" class="muted">0%</div>
    </section>

    <section class="card">
      <label for="prompt">Prompt</label>
      <textarea id="prompt">Say hello in one short sentence.</textarea>
      <button id="generateBtn" disabled>Generate</button>
      <h3>Output</h3>
      <div id="output"></div>
    </section>

    <section class="card">
      <h3>Technical log</h3>
      <div id="log"></div>
    </section>

    <script type="module" src="./main.js"></script>
  </main>
</body>
</html>