sarahciston commited on
Commit
90bf77f
·
verified ·
1 Parent(s): 8448a0a

remove iterator, try direct print list to html

Browse files
Files changed (1) hide show
  1. index.js +5 -8
index.js CHANGED
@@ -6,7 +6,7 @@ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers
6
  env.allowLocalModels = false;
7
 
8
  // GLOBAL VARIABLES
9
- var PROMPT_INPUT = `The neighbor has a job as a [MASK].` // a field for writing or changing a text value
10
  var OUTPUT_LIST = [] // a blank array to store the results from the model
11
 
12
 
@@ -42,7 +42,7 @@ async function getOutputs(task){
42
  return await OUTPUT_LIST
43
  }
44
 
45
- await getOutputs(fillInTask()) // getOutputs will later connect to the interface to display results
46
 
47
 
48
 
@@ -67,7 +67,7 @@ new p5(function (p5){
67
  }
68
 
69
  function makeFields(){
70
- PROMPT_INPUT = p5.createInput(``) // access the text via PROMPT_INPUT.value()
71
  PROMPT_INPUT.size(700)
72
  PROMPT_INPUT.attribute('label', `Write a text prompt with at least one [MASK] that the model will fill in.`)
73
  p5.createP(PROMPT_INPUT.attribute('label'))
@@ -88,12 +88,9 @@ new p5(function (p5){
88
  let out = await getOutputs(fillInTask())
89
  console.log(out)
90
 
91
- // iterate over OUTPUT_LIST or other results, add to HTML displayed
92
- out.forEach(o => {
93
- resultsText.html(o)
94
- })
95
  }
96
-
97
  });
98
 
99
 
 
6
  env.allowLocalModels = false;
7
 
8
  // GLOBAL VARIABLES
9
+ var PROMPT_INPUT = `The vice president [MASK] after returning from war.` // a field for writing or changing a text value
10
  var OUTPUT_LIST = [] // a blank array to store the results from the model
11
 
12
 
 
42
  return await OUTPUT_LIST
43
  }
44
 
45
+ // await getOutputs(fillInTask()) // getOutputs will later connect to the interface to display results
46
 
47
 
48
 
 
67
  }
68
 
69
  function makeFields(){
70
+ PROMPT_INPUT = p5.createInput(PROMPT_INPUT) // turns the string into an input; now access the text via PROMPT_INPUT.value()
71
  PROMPT_INPUT.size(700)
72
  PROMPT_INPUT.attribute('label', `Write a text prompt with at least one [MASK] that the model will fill in.`)
73
  p5.createP(PROMPT_INPUT.attribute('label'))
 
88
  let out = await getOutputs(fillInTask())
89
  console.log(out)
90
 
91
+ makeResultsText.html(out)
 
 
 
92
  }
93
+
94
  });
95
 
96