PeterPinetree commited on
Commit
54c6c11
·
verified ·
1 Parent(s): 837a57b

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +14 -12
index.html CHANGED
@@ -104,26 +104,28 @@
104
  </section>
105
  </div>
106
  </main>
107
-
108
  <script type="module">
109
- // --- Import Transformers.js from CDN instead of a vendored file ---
110
- const {
111
- env,
112
- AutoTokenizer,
113
- AutoModelForCausalLM
114
- } = await import('https://cdn.jsdelivr.net/npm/@xenova/transformers@3.2.1');
115
-
116
- // --- Backend config (no cross-origin isolation) ---
 
117
  env.useBrowserCache = true;
118
  env.allowLocalModels = true;
119
  env.localModelPath = new URL('assets/models/', window.location.href).href;
120
- env.allowRemoteModels = false; // we only want to use local models here
121
  env.backends.onnx.webgpu = { enabled: false };
122
  env.backends.onnx.preferredBackend = 'wasm';
123
  env.backends.onnx.wasm.numThreads = 1;
124
  env.backends.onnx.wasm.proxy = false;
125
- if (typeof env.backends.onnx.wasm.jsep !== 'undefined') env.backends.onnx.wasm.jsep = false;
126
- env.backends.onnx.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.17.1/dist/';
 
 
127
 
128
  // --- DOM helpers / UI state ---
129
  const $ = (s) => document.querySelector(s);
 
104
  </section>
105
  </div>
106
  </main>
 
107
  <script type="module">
108
+ // Import the Hugging Face Transformers.js module
109
+ const {
110
+ pipeline,
111
+ env,
112
+ AutoTokenizer,
113
+ AutoModelForCausalLM,
114
+ } = await import('https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.7.3');
115
+
116
+ // --- Backend config (no cross‑origin isolation) ---
117
  env.useBrowserCache = true;
118
  env.allowLocalModels = true;
119
  env.localModelPath = new URL('assets/models/', window.location.href).href;
120
+ env.allowRemoteModels = false;
121
  env.backends.onnx.webgpu = { enabled: false };
122
  env.backends.onnx.preferredBackend = 'wasm';
123
  env.backends.onnx.wasm.numThreads = 1;
124
  env.backends.onnx.wasm.proxy = false;
125
+ if (typeof env.backends.onnx.wasm.jsep !== 'undefined') {
126
+ env.backends.onnx.wasm.jsep = false;
127
+ }
128
+ env.backends.onnx.wasm.wasmPaths = 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.17.1/dist/';
129
 
130
  // --- DOM helpers / UI state ---
131
  const $ = (s) => document.querySelector(s);