File size: 2,590 Bytes
bfaf968
bdb093b
 
bfaf968
 
 
 
 
 
bdb093b
bfaf968
 
 
bdb093b
 
bfaf968
 
 
 
 
 
bdb093b
 
bfaf968
 
 
 
5c8fb6b
bfaf968
bdb093b
 
bfaf968
 
 
 
5c8fb6b
 
 
bfaf968
 
 
 
 
 
 
 
 
 
 
 
 
bdb093b
 
 
bfaf968
 
 
 
5c8fb6b
bdb093b
bfaf968
a811362
 
bdb093b
 
bfaf968
 
bdb093b
 
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
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <title>Browser LLM Evaluation</title>
    <link rel="stylesheet" href="styles.css">
    <!-- transformers.js CDN - adjust to latest release if needed -->
    <script src="https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.6"></script>
</head>
<body>
<main class="container">
    <h1>Browser LLM Evaluation</h1>


    <section class="grid">
        <div class="card">
            <h2>Cloud (OpenRouter)</h2>
            <label>API Key <input id="apiKey" type="password" placeholder="sk-..." /></label>
            <label>Model <input id="cloudModel" value="gpt-4o-mini" /></label>
        </div>


        <div class="card">
            <h2>On-Device</h2>
            <label>Model (transformers.js) <input id="deviceModel" value="distilgpt2" /></label>
            <div id="deviceStatus">Not loaded</div>
            <button id="loadDeviceModelBtn">Load Model</button>
        </div>


        <div class="card">
            <h2>Request Pattern</h2>
            <select id="patternSelect">
                <option value="once-per-sec">1 request / sec</option>
                <option value="every-ten-sec">Every 10 sec 1 request</option>
                <option disabled value="batch-10-every-5s">(not implemented) Batch: 10 every 5s</option>
                <option disabled value="burst">(not implemented) Burst: 50 then idle</option>
            </select>
            <label>Route strategy
                <select id="routeStrategy">
                    <option value="roundrobin">Round Robin</option>
                    <option value="probabilistic">Probabilistic (p to cloud)</option>
                    <option value="always_cloud">Always cloud</option>
                    <option value="always_device">Always device</option>
                </select>
            </label>
            <label>Cloud probability (for probabilistic) <input id="cloudProb" type="number" min="0" max="1" step="0.1" value="0.5"/></label>
            <div class="buttons">
                <button id="startBtn">Start</button>
                <button id="stopBtn" disabled>Stop</button>
            </div>
        </div>

        <div class="card wide">
            <h2>Live Log & Results</h2>
            <div id="log" class="log"></div>
            <div id="stats"></div>
            <button id="downloadStats">Download Statistics</button>
        </div>
    </section>


</main>


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