Yang Gu commited on
Commit
b8e7170
1 Parent(s): 5b4769b

Differentiate the path for local server and hf

Browse files
Files changed (1) hide show
  1. index.html +25 -18
index.html CHANGED
@@ -1,12 +1,17 @@
1
  <title>WebGPU AI Demos</title>
2
  <body>
3
  <h1 align="center">WebGPU AI Demos</h1>
4
- <script src="main.js"></script>
5
  <script>
6
  "use strict";
7
- const demos = [["LLMs with MediaPipe and TFLite", "llm-inference", "<a href=https://github.com/googlesamples/mediapipe/tree/main/examples/llm_inference/js>original code</a>, <a href=https://developers.googleblog.com/2024/03/running-large-language-models-on-device-with-mediapipe-andtensorflow-lite.html>more info</a>"]];
 
 
 
 
 
 
8
 
9
- // table
10
  const table = document.createElement("table");
11
  table.align = "center";
12
  table.style.width = "80%";
@@ -15,22 +20,24 @@
15
 
16
  // first line
17
  let row = table.insertRow(-1);
18
- const headers = ["Name", "Description"];
19
  row.style.fontWeight = "bold";
20
- for (let header of headers) {
21
- let td = row.insertCell(-1);
22
- td.innerHTML = header;
23
- }
24
-
25
- // rest of lines
26
- for (let demo of demos) {
27
- row = table.insertRow(-1);
28
- let td = row.insertCell(-1);
29
- td.innerHTML = `<a href=/${demo[1]}/index.html>${demo[0]}</a>`;
30
- td = row.insertCell(-1);
31
- td.innerHTML = demo[2];
32
- }
33
-
34
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  </script>
36
  </body>
 
1
  <title>WebGPU AI Demos</title>
2
  <body>
3
  <h1 align="center">WebGPU AI Demos</h1>
 
4
  <script>
5
  "use strict";
6
+ const demos = [
7
+ [
8
+ "LLMs with MediaPipe and TFLite",
9
+ "llm-inference",
10
+ "<a href=https://github.com/googlesamples/mediapipe/tree/main/examples/llm_inference/js>original code</a>, <a href=https://developers.googleblog.com/2024/03/running-large-language-models-on-device-with-mediapipe-andtensorflow-lite.html>more info</a>",
11
+ ],
12
+ ];
13
 
14
+ // table
15
  const table = document.createElement("table");
16
  table.align = "center";
17
  table.style.width = "80%";
 
20
 
21
  // first line
22
  let row = table.insertRow(-1);
23
+ const headers = ["Name", "Description"];
24
  row.style.fontWeight = "bold";
25
+ for (let header of headers) {
26
+ let td = row.insertCell(-1);
27
+ td.innerHTML = header;
28
+ }
 
 
 
 
 
 
 
 
 
 
29
 
30
+ // rest of lines
31
+ for (let demo of demos) {
32
+ row = table.insertRow(-1);
33
+ let td = row.insertCell(-1);
34
+ let href = demo[1];
35
+ if (window.location.origin.includes("hf")) {
36
+ href = `/${href}`;
37
+ }
38
+ td.innerHTML = `<a href=${href}>${demo[0]}</a>`;
39
+ td = row.insertCell(-1);
40
+ td.innerHTML = demo[2];
41
+ }
42
  </script>
43
  </body>