Sarah Ciston commited on
Commit
f1f8f5b
·
1 Parent(s): 03baa48

cloud link to transformer

Browse files
Files changed (1) hide show
  1. index.js +9 -3
index.js CHANGED
@@ -1,8 +1,8 @@
1
- // import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
2
  // import { HfInference } from 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected]/+esm';
3
  // const inference = new HfInference();
4
 
5
- import { pipeline } from '@xenova/transformers';
6
 
7
  let pipe = await pipeline('text-generation');
8
 
@@ -34,7 +34,7 @@ var result = await out.choices[0].message;
34
 
35
  //sends the text to a global var (not best way cant figure out better)
36
  // window.modelOutput = result.content;
37
- // modelOutput = result.content
38
 
39
  // console.log('huggingface loaded');
40
 
@@ -183,6 +183,12 @@ new p5(function(p5){
183
  maskInputC.size(200);
184
  maskInputC.elt.style.fontSize = "15px";
185
 
 
 
 
 
 
 
186
  }
187
 
188
  function makeInput(i){
 
1
+ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/[email protected]';
2
  // import { HfInference } from 'https://cdn.jsdelivr.net/npm/@huggingface/[email protected]/+esm';
3
  // const inference = new HfInference();
4
 
5
+ // import { pipeline } from '@xenova/transformers';
6
 
7
  let pipe = await pipeline('text-generation');
8
 
 
34
 
35
  //sends the text to a global var (not best way cant figure out better)
36
  // window.modelOutput = result.content;
37
+ modelOutput = result.content
38
 
39
  // console.log('huggingface loaded');
40
 
 
183
  maskInputC.size(200);
184
  maskInputC.elt.style.fontSize = "15px";
185
 
186
+ modOutput = p5.createElement("p", "Results:");
187
+ modOutput.position(0, 380);
188
+ setTimeout(() => {
189
+ modOutput.html(modelOutput)
190
+ }, 2000);
191
+
192
  }
193
 
194
  function makeInput(i){