Spaces:
Running
Running
move intructDiv into introDiv, move addField funct into inputDiv
Browse files
sketch.js
CHANGED
|
@@ -133,12 +133,12 @@ new p5(function (p5){
|
|
| 133 |
const introDiv = p5.createDiv().class('module').id('intro')
|
| 134 |
p5.createElement('h1','p5.js Critical AI Prompt Battle').parent(introDiv)
|
| 135 |
p5.createP(`What do AI models really 'know' about you — about your community, your language, your culture? What do they 'know' about different concepts, ideas, and worldviews?`).parent(introDiv)
|
| 136 |
-
p5.createP(`This tool lets you compare the results of multiple AI-generated texts and images side-by-side, using blanks you fill in to explore variations on a single prompt. For more info on prompt programming and critical AI, see [TUTORIAL-LINK]
|
| 137 |
|
| 138 |
-
const instructDiv = p5.createDiv().class('module').id('instructions')
|
| 139 |
-
p5.createElement('h4', 'INSTRUCTIONS').class('header').parent(
|
| 140 |
-
p5.createP(`Write your prompt using [BLANK] and [MASK], where [BLANK] will be the variation you choose and fill in below, and [MASK] is a variation that the model will complete.`).parent(
|
| 141 |
-
p5.createP(`For best results, try to phrase your prompt so that [BLANK] and [MASK] highlight the qualities you want to investigate. <A href="
|
| 142 |
}
|
| 143 |
|
| 144 |
function makeInputModule(){
|
|
@@ -161,25 +161,26 @@ new p5(function (p5){
|
|
| 161 |
addField()
|
| 162 |
addField()
|
| 163 |
|
| 164 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 165 |
const submitButton = p5.createButton("RUN PROMPT")
|
| 166 |
submitButton.size(170)
|
| 167 |
submitButton.class('button').parent(inputDiv)
|
| 168 |
submitButton.mousePressed(displayOutput)
|
| 169 |
}
|
| 170 |
|
| 171 |
-
function addField(){
|
| 172 |
-
let f = p5.createInput("").parent(inputDiv)
|
| 173 |
-
f.class("blank")
|
| 174 |
-
blanksArray.push(f)
|
| 175 |
-
console.log("made variable field")
|
| 176 |
-
// // Cap the number of fields, avoids token limit in prompt
|
| 177 |
-
// let blanks = document.querySelectorAll(".blank")
|
| 178 |
-
// if (blanks.length > 3){
|
| 179 |
-
// console.log(blanks.length)
|
| 180 |
-
// addButton.style('visibility','hidden')
|
| 181 |
-
// }
|
| 182 |
-
}
|
| 183 |
|
| 184 |
// function makeButtons(){
|
| 185 |
// // // press to add more blanks to fill in
|
|
|
|
| 133 |
const introDiv = p5.createDiv().class('module').id('intro')
|
| 134 |
p5.createElement('h1','p5.js Critical AI Prompt Battle').parent(introDiv)
|
| 135 |
p5.createP(`What do AI models really 'know' about you — about your community, your language, your culture? What do they 'know' about different concepts, ideas, and worldviews?`).parent(introDiv)
|
| 136 |
+
p5.createP(`This tool lets you compare the results of multiple AI-generated texts and images side-by-side, using blanks you fill in to explore variations on a single prompt. For more info on prompt programming and critical AI, see <A href="">[TUTORIAL-LINK]</a>.`).parent(introDiv)
|
| 137 |
|
| 138 |
+
// const instructDiv = p5.createDiv().class('module').id('instructions')
|
| 139 |
+
p5.createElement('h4', 'INSTRUCTIONS').class('header').parent(introDiv)
|
| 140 |
+
p5.createP(`Write your prompt using [BLANK] and [MASK], where [BLANK] will be the variation you choose and fill in below, and [MASK] is a variation that the model will complete.`).parent(introDiv)
|
| 141 |
+
p5.createP(`For best results, try to phrase your prompt so that [BLANK] and [MASK] highlight the qualities you want to investigate. See <A href="">[EXAMPLES]</a>`).parent(introDiv)
|
| 142 |
}
|
| 143 |
|
| 144 |
function makeInputModule(){
|
|
|
|
| 161 |
addField()
|
| 162 |
addField()
|
| 163 |
|
| 164 |
+
function addField(){
|
| 165 |
+
let f = p5.createInput("").parent(inputDiv)
|
| 166 |
+
f.class("blank")
|
| 167 |
+
blanksArray.push(f)
|
| 168 |
+
console.log("made variable field")
|
| 169 |
+
// // Cap the number to avoids token limit
|
| 170 |
+
// let blanks = document.querySelectorAll(".blank")
|
| 171 |
+
// if (blanks.length > 3){
|
| 172 |
+
// console.log(blanks.length)
|
| 173 |
+
// addButton.style('visibility','hidden')
|
| 174 |
+
// }
|
| 175 |
+
}
|
| 176 |
+
|
| 177 |
+
// press to run model
|
| 178 |
const submitButton = p5.createButton("RUN PROMPT")
|
| 179 |
submitButton.size(170)
|
| 180 |
submitButton.class('button').parent(inputDiv)
|
| 181 |
submitButton.mousePressed(displayOutput)
|
| 182 |
}
|
| 183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
|
| 185 |
// function makeButtons(){
|
| 186 |
// // // press to add more blanks to fill in
|