Javedalam commited on
Commit
a703e60
·
verified ·
1 Parent(s): 98662d0

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +40 -0
index.html ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <title>Granite ONNX Loader</title>
6
+ </head>
7
+ <body>
8
+ <h3>Granite 4.0-micro-ONNX-web Test</h3>
9
+ <button id="run">Load Model</button>
10
+ <div id="log" style="margin-top:10px;font-family:monospace;white-space:pre-wrap;"></div>
11
+
12
+ <script type="module">
13
+ import { pipeline } from "https://cdn.jsdelivr.net/npm/@huggingface/transformers@4";
14
+
15
+ const log = document.getElementById("log");
16
+ const btn = document.getElementById("run");
17
+ const append = (msg) => { log.textContent += msg + "\n"; };
18
+
19
+ btn.onclick = async () => {
20
+ log.textContent = "";
21
+ append("Starting…");
22
+
23
+ try {
24
+ append("Downloading model: onnx-community/granite-4.0-micro-ONNX-web");
25
+ const pipe = await pipeline(
26
+ "text-generation",
27
+ "onnx-community/granite-4.0-micro-ONNX-web",
28
+ { progress_callback: (p) => append(`Progress: ${p * 100}%`) }
29
+ );
30
+
31
+ append("Model ready. Running inference…");
32
+ const out = await pipe("The future of AI is", { max_new_tokens: 30 });
33
+ append("Output:\n" + out[0].generated_text);
34
+ } catch (e) {
35
+ append("ERROR: " + (e.message || e));
36
+ }
37
+ };
38
+ </script>
39
+ </body>
40
+ </html>