Spaces:
Running
Running
update var names
Browse files
sketch.js
CHANGED
@@ -130,21 +130,20 @@ new p5(function (p5){
|
|
130 |
}
|
131 |
|
132 |
function makeTextModules(){
|
133 |
-
const introDiv = p5.createDiv().class('module').
|
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].`).parent(introDiv)
|
137 |
|
138 |
-
const instructDiv = p5.createDiv().class('module').
|
139 |
p5.createElement('h4', 'INSTRUCTIONS').class('header').parent(instructDiv)
|
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(instructDiv)
|
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="http://p5js.org">See examples.</a>`).parent(instructDiv)
|
142 |
}
|
143 |
|
144 |
function makeInputModule(){
|
145 |
-
const inputDiv = p5.createDiv()
|
146 |
-
p5.createElement('h4', 'INPUT').
|
147 |
-
inputDiv.id('inputDiv').class('module').class('main')
|
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)
|
@@ -172,7 +171,6 @@ new p5(function (p5){
|
|
172 |
function addField(){
|
173 |
let f = p5.createInput("").parent(inputDiv)
|
174 |
f.class("blank")
|
175 |
-
// f.parent("#inputDiv")
|
176 |
blanksArray.push(f)
|
177 |
console.log("made variable field")
|
178 |
// // Cap the number of fields, avoids token limit in prompt
|
@@ -192,23 +190,22 @@ new p5(function (p5){
|
|
192 |
// }
|
193 |
|
194 |
function makeOutputModule(){
|
195 |
-
const
|
196 |
-
|
197 |
-
const outHeader = p5.createElement('h4',"OUTPUT").parent(outDiv)
|
198 |
-
|
199 |
-
//make output placeholders
|
200 |
|
|
|
201 |
// text-only output
|
202 |
-
p5.createElement('h3', 'Text output').parent(
|
203 |
-
outText = p5.createP('').id('outText').parent(
|
204 |
|
205 |
-
//
|
206 |
-
p5.createElement('h3', 'Text-to-image output').parent(
|
207 |
-
outPics = p5.createDiv().id('outPics').parent(
|
208 |
// img1 = p5.createImg('URL')
|
209 |
-
|
210 |
-
|
211 |
-
|
|
|
212 |
}
|
213 |
|
214 |
async function displayOutput(){
|
|
|
130 |
}
|
131 |
|
132 |
function makeTextModules(){
|
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].`).parent(introDiv)
|
137 |
|
138 |
+
const instructDiv = p5.createDiv().class('module').id('instructions')
|
139 |
p5.createElement('h4', 'INSTRUCTIONS').class('header').parent(instructDiv)
|
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(instructDiv)
|
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="http://p5js.org">See examples.</a>`).parent(instructDiv)
|
142 |
}
|
143 |
|
144 |
function makeInputModule(){
|
145 |
+
const inputDiv = p5.createDiv().class('module', 'main').id('inputDiv')
|
146 |
+
p5.createElement('h4', 'INPUT').parent(inputDiv)
|
|
|
147 |
p5.createElement('h3', 'Enter your prompt').class('header').parent(inputDiv)
|
148 |
p5.createP('Write your prompt in the box below using one [BLANK] and one [MASK].').parent(inputDiv)
|
149 |
p5.createP('e.g. Write "The [BLANK] was a [MASK]..." and in the three blanks choose three occupations.').parent(inputDiv)
|
|
|
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
|
|
|
190 |
// }
|
191 |
|
192 |
function makeOutputModule(){
|
193 |
+
const outputDiv = p5.createDiv().class('module').id('outputDiv')
|
194 |
+
const outHeader = p5.createElement('h4',"OUTPUT").parent(outputDiv)
|
|
|
|
|
|
|
195 |
|
196 |
+
// // make output placeholders
|
197 |
// text-only output
|
198 |
+
p5.createElement('h3', 'Text output').parent(outputDiv)
|
199 |
+
let outText = p5.createP('').id('outText').parent(outputDiv)
|
200 |
|
201 |
+
// placeholder DIV for images and captions
|
202 |
+
p5.createElement('h3', 'Text-to-image output').parent(outputDiv)
|
203 |
+
let outPics = p5.createDiv().id('outPics').parent(outputDiv)
|
204 |
// img1 = p5.createImg('URL')
|
205 |
+
|
206 |
+
// print info about model, prompt, and hyperparams
|
207 |
+
p5.createElement('h3', 'Prompting info').parent(outputDiv)
|
208 |
+
let outInfo = p5.createP('').id('outInfo').parent(outputDiv)
|
209 |
}
|
210 |
|
211 |
async function displayOutput(){
|