Spaces:
Running
Running
Update imput sections
Browse files
sketch.js
CHANGED
@@ -7,7 +7,7 @@ env.allowLocalModels = false;
|
|
7 |
|
8 |
// GLOBAL VARIABLES
|
9 |
|
10 |
-
var PREPROMPT = `Please continue
|
11 |
// var PREPROMPT = `Please continue the story, filling in any [MASK] with your own words:`
|
12 |
// let PREPROMPT = `Please complete the phrase and fill in any [MASK]: `
|
13 |
var PROMPT_INPUT = `` // a field for writing or changing a text value
|
@@ -146,9 +146,9 @@ new p5(function (p5){
|
|
146 |
const inputDiv = p5.createDiv().class('module', 'main').id('inputDiv')
|
147 |
p5.createElement('h4', 'INPUT').parent(inputDiv)
|
148 |
p5.createElement('h3', 'Enter your prompt').class('header').parent(inputDiv)
|
149 |
-
p5.createP(
|
150 |
-
p5.createP(
|
151 |
-
p5.createP(
|
152 |
promptField = p5.createInput(PROMPT_INPUT).parent(inputDiv) // turns the string into an input; now access the text via PROMPT_INPUT.value()
|
153 |
promptField.size(700)
|
154 |
p5.createP(promptField.attribute('label')).parent(inputDiv)
|
@@ -158,8 +158,20 @@ new p5(function (p5){
|
|
158 |
p5.createElement('h3', 'Fill in your blanks').class('header').parent(inputDiv)
|
159 |
p5.createP('Add three words or phrases in the boxes below that will replace the [BLANK] in your prompt when the model runs.').parent(inputDiv)
|
160 |
p5.createP('(e.g. doctor, secretary, circus performer)').parent(inputDiv)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
|
162 |
-
|
163 |
let f = p5.createInput("").parent(inputDiv)
|
164 |
f.class("blank")
|
165 |
blanksArray.push(f)
|
@@ -172,20 +184,6 @@ new p5(function (p5){
|
|
172 |
// }
|
173 |
}
|
174 |
|
175 |
-
addField()
|
176 |
-
addField()
|
177 |
-
addField()
|
178 |
-
|
179 |
-
// press to run model
|
180 |
-
const submitButton = p5.createButton("RUN PROMPT")
|
181 |
-
submitButton.size(170)
|
182 |
-
submitButton.class('button').parent(inputDiv)
|
183 |
-
submitButton.mousePressed(displayOutput)
|
184 |
-
|
185 |
-
|
186 |
-
}
|
187 |
-
|
188 |
-
|
189 |
// function makeButtons(){
|
190 |
// // // press to add more blanks to fill in
|
191 |
// // const addButton = p5.createButton("more blanks")
|
|
|
7 |
|
8 |
// GLOBAL VARIABLES
|
9 |
|
10 |
+
var PREPROMPT = `Please continue each sentence after "..." and replace the "[MASK]" with your own words: `
|
11 |
// var PREPROMPT = `Please continue the story, filling in any [MASK] with your own words:`
|
12 |
// let PREPROMPT = `Please complete the phrase and fill in any [MASK]: `
|
13 |
var PROMPT_INPUT = `` // a field for writing or changing a text value
|
|
|
146 |
const inputDiv = p5.createDiv().class('module', 'main').id('inputDiv')
|
147 |
p5.createElement('h4', 'INPUT').parent(inputDiv)
|
148 |
p5.createElement('h3', 'Enter your prompt').class('header').parent(inputDiv)
|
149 |
+
p5.createP(`Write your prompt in the box below using one [BLANK] and one [MASK].`).parent(inputDiv)
|
150 |
+
p5.createP(`e.g. Write "The [BLANK] was a [MASK]..." and in the three blanks choose three occupations.`).parent(inputDiv)
|
151 |
+
p5.createP(`(This is taken from an actual example used to test GPT-3. (Brown et al. 2020).)`).class('caption').parent(inputDiv)
|
152 |
promptField = p5.createInput(PROMPT_INPUT).parent(inputDiv) // turns the string into an input; now access the text via PROMPT_INPUT.value()
|
153 |
promptField.size(700)
|
154 |
p5.createP(promptField.attribute('label')).parent(inputDiv)
|
|
|
158 |
p5.createElement('h3', 'Fill in your blanks').class('header').parent(inputDiv)
|
159 |
p5.createP('Add three words or phrases in the boxes below that will replace the [BLANK] in your prompt when the model runs.').parent(inputDiv)
|
160 |
p5.createP('(e.g. doctor, secretary, circus performer)').parent(inputDiv)
|
161 |
+
|
162 |
+
addField()
|
163 |
+
addField()
|
164 |
+
addField()
|
165 |
+
|
166 |
+
// press to run model
|
167 |
+
const submitButton = p5.createButton("RUN PROMPT")
|
168 |
+
submitButton.size(170)
|
169 |
+
submitButton.class('button').parent(inputDiv)
|
170 |
+
submitButton.mousePressed(displayOutput)
|
171 |
+
|
172 |
+
}
|
173 |
|
174 |
+
function addField(){
|
175 |
let f = p5.createInput("").parent(inputDiv)
|
176 |
f.class("blank")
|
177 |
blanksArray.push(f)
|
|
|
184 |
// }
|
185 |
}
|
186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
187 |
// function makeButtons(){
|
188 |
// // // press to add more blanks to fill in
|
189 |
// // const addButton = p5.createButton("more blanks")
|