Spaces:
Running
Running
remove interface, change buttons
Browse files
sketch.js
CHANGED
|
@@ -135,14 +135,14 @@ new p5(function (p5){
|
|
| 135 |
|
| 136 |
function makeTextDisplay(){
|
| 137 |
const title = p5.createElement('h1','p5.js Critical AI Prompt Battle')
|
| 138 |
-
const intro = p5.createP(`This tool lets you explore several AI prompts results at once.`)
|
| 139 |
-
p5.createP(`Use it to explore what models 'know' about various concepts, communities, and cultures. For more information on prompt programming and critical AI, see [Tutorial & extra info][TO-DO][XXX]`)
|
| 140 |
}
|
| 141 |
|
| 142 |
function makeFields(){
|
| 143 |
promptField = p5.createInput(PROMPT_INPUT) // turns the string into an input; now access the text via PROMPT_INPUT.value()
|
| 144 |
promptField.size(700)
|
| 145 |
-
promptField.attribute('label', `Write a text prompt with one [MASK] that the model will fill in.`)
|
| 146 |
p5.createP(promptField.attribute('label'))
|
| 147 |
promptField.addClass("prompt")
|
| 148 |
|
|
@@ -153,18 +153,19 @@ new p5(function (p5){
|
|
| 153 |
}
|
| 154 |
|
| 155 |
function makeButtons(){
|
| 156 |
-
// press to run model
|
| 157 |
-
const submitButton = p5.createButton("SUBMIT")
|
| 158 |
-
submitButton.size(170)
|
| 159 |
-
submitButton.class('submit')
|
| 160 |
-
submitButton.mousePressed(displayResults)
|
| 161 |
|
| 162 |
// press to add more blanks to fill in
|
| 163 |
const addButton = p5.createButton("more blanks")
|
| 164 |
addButton.size(170)
|
| 165 |
// addButton.position(220,500)
|
| 166 |
addButton.mousePressed(addField)
|
| 167 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
// also make results placeholder
|
| 169 |
const outHeader = p5.createElement('h3',"Results")
|
| 170 |
outText = p5.createP('').id('results')
|
|
@@ -206,7 +207,7 @@ new p5(function (p5){
|
|
| 206 |
|
| 207 |
// Cap the number of fields, avoids token limit in prompt
|
| 208 |
let blanks = document.querySelectorAll(".blank")
|
| 209 |
-
if (blanks.length >
|
| 210 |
console.log(blanks.length)
|
| 211 |
addButton.style('visibility','hidden')
|
| 212 |
}
|
|
|
|
| 135 |
|
| 136 |
function makeTextDisplay(){
|
| 137 |
const title = p5.createElement('h1','p5.js Critical AI Prompt Battle')
|
| 138 |
+
// const intro = p5.createP(`This tool lets you explore several AI prompts results at once.`)
|
| 139 |
+
// p5.createP(`Use it to explore what models 'know' about various concepts, communities, and cultures. For more information on prompt programming and critical AI, see [Tutorial & extra info][TO-DO][XXX]`)
|
| 140 |
}
|
| 141 |
|
| 142 |
function makeFields(){
|
| 143 |
promptField = p5.createInput(PROMPT_INPUT) // turns the string into an input; now access the text via PROMPT_INPUT.value()
|
| 144 |
promptField.size(700)
|
| 145 |
+
// promptField.attribute('label', `Write a text prompt with one [MASK] that the model will fill in.`)
|
| 146 |
p5.createP(promptField.attribute('label'))
|
| 147 |
promptField.addClass("prompt")
|
| 148 |
|
|
|
|
| 153 |
}
|
| 154 |
|
| 155 |
function makeButtons(){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 156 |
|
| 157 |
// press to add more blanks to fill in
|
| 158 |
const addButton = p5.createButton("more blanks")
|
| 159 |
addButton.size(170)
|
| 160 |
// addButton.position(220,500)
|
| 161 |
addButton.mousePressed(addField)
|
| 162 |
+
|
| 163 |
+
// press to run model
|
| 164 |
+
const submitButton = p5.createButton("SUBMIT")
|
| 165 |
+
submitButton.size(170)
|
| 166 |
+
submitButton.class('submit')
|
| 167 |
+
submitButton.mousePressed(displayResults)
|
| 168 |
+
|
| 169 |
// also make results placeholder
|
| 170 |
const outHeader = p5.createElement('h3',"Results")
|
| 171 |
outText = p5.createP('').id('results')
|
|
|
|
| 207 |
|
| 208 |
// Cap the number of fields, avoids token limit in prompt
|
| 209 |
let blanks = document.querySelectorAll(".blank")
|
| 210 |
+
if (blanks.length > 3){
|
| 211 |
console.log(blanks.length)
|
| 212 |
addButton.style('visibility','hidden')
|
| 213 |
}
|