Sarah Ciston
commited on
Commit
·
283a922
1
Parent(s):
d483a10
add back await, remove other global vars
Browse files
sketch.js
CHANGED
@@ -16,9 +16,7 @@ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers
|
|
16 |
|
17 |
// establish global variables
|
18 |
|
19 |
-
let
|
20 |
-
PREPROMPT,
|
21 |
-
promptInput,
|
22 |
modelDisplay,
|
23 |
modelResult;
|
24 |
|
@@ -132,11 +130,11 @@ new p5(function (p5) {
|
|
132 |
console.log(INPUTVALUES)
|
133 |
|
134 |
// Do model stuff in this function instead of in general
|
135 |
-
PROMPT = promptInput.value() // updated check of the prompt field
|
136 |
|
137 |
// BLANKS = inputValues // get ready to feed array list into model
|
138 |
|
139 |
-
PREPROMPT = `Please return an array of sentences. In each sentence, fill in the [BLANK] in the following sentence with each word I provide in the array ${INPUTVALUES}. Replace any [FILL] with an appropriate word of your choice.`
|
140 |
|
141 |
// we pass PROMPT and PREPROMPT to the model function, don't need to pass INPUTVALUES bc it's passed into the PREPROMPT already here
|
142 |
|
@@ -145,9 +143,9 @@ new p5(function (p5) {
|
|
145 |
displayModel(modelResult)
|
146 |
}
|
147 |
|
148 |
-
function displayModel(m){
|
149 |
let modelDisplay = p5.createElement("p", "Results:");
|
150 |
-
modelDisplay.html(m)
|
151 |
}
|
152 |
|
153 |
// async function showResults(){
|
|
|
16 |
|
17 |
// establish global variables
|
18 |
|
19 |
+
let promptInput,
|
|
|
|
|
20 |
modelDisplay,
|
21 |
modelResult;
|
22 |
|
|
|
130 |
console.log(INPUTVALUES)
|
131 |
|
132 |
// Do model stuff in this function instead of in general
|
133 |
+
let PROMPT = promptInput.value() // updated check of the prompt field
|
134 |
|
135 |
// BLANKS = inputValues // get ready to feed array list into model
|
136 |
|
137 |
+
let PREPROMPT = `Please return an array of sentences. In each sentence, fill in the [BLANK] in the following sentence with each word I provide in the array ${INPUTVALUES}. Replace any [FILL] with an appropriate word of your choice.`
|
138 |
|
139 |
// we pass PROMPT and PREPROMPT to the model function, don't need to pass INPUTVALUES bc it's passed into the PREPROMPT already here
|
140 |
|
|
|
143 |
displayModel(modelResult)
|
144 |
}
|
145 |
|
146 |
+
async function displayModel(m){
|
147 |
let modelDisplay = p5.createElement("p", "Results:");
|
148 |
+
await modelDisplay.html(m)
|
149 |
}
|
150 |
|
151 |
// async function showResults(){
|