Spaces:
Running
Running
sarahciston
commited on
test field update
Browse files
index.js
CHANGED
@@ -6,7 +6,7 @@ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers
|
|
6 |
env.allowLocalModels = false;
|
7 |
|
8 |
// GLOBAL VARIABLES
|
9 |
-
let PROMPT_INPUT = `Happy people
|
10 |
let OUTPUT_LIST = [] // a blank array to store the results from the model
|
11 |
let pField
|
12 |
|
@@ -69,17 +69,18 @@ new p5(function (p5){
|
|
69 |
|
70 |
function makeTextDisplay(){
|
71 |
let title = p5.createElement('h1','p5.js Critical AI Prompt Battle')
|
72 |
-
let intro = p5.createP(`This tool lets you
|
|
|
73 |
}
|
74 |
|
75 |
function makeFields(){
|
76 |
pField = p5.createInput(PROMPT_INPUT) // turns the string into an input; now access the text via PROMPT_INPUT.value()
|
77 |
pField.size(700)
|
78 |
-
pField.attribute('label', `Write a text prompt with
|
79 |
p5.createP(pField.attribute('label'))
|
80 |
pField.addClass("prompt")
|
81 |
-
pField.value(PROMPT_INPUT)
|
82 |
-
console.log(pField.value())
|
83 |
}
|
84 |
|
85 |
function makeButtons(){
|
@@ -92,7 +93,8 @@ new p5(function (p5){
|
|
92 |
async function displayResults(){
|
93 |
console.log('displayed, pressed')
|
94 |
|
95 |
-
|
|
|
96 |
|
97 |
let fillIn = await fillInTask(PROMPT_INPUT)
|
98 |
|
|
|
6 |
env.allowLocalModels = false;
|
7 |
|
8 |
// GLOBAL VARIABLES
|
9 |
+
let PROMPT_INPUT = `Happy people are better than [MASK].` // a field for writing or changing a text value
|
10 |
let OUTPUT_LIST = [] // a blank array to store the results from the model
|
11 |
let pField
|
12 |
|
|
|
69 |
|
70 |
function makeTextDisplay(){
|
71 |
let title = p5.createElement('h1','p5.js Critical AI Prompt Battle')
|
72 |
+
let intro = p5.createP(`This tool lets you explore several AI prompts results at once.`)
|
73 |
+
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]`)
|
74 |
}
|
75 |
|
76 |
function makeFields(){
|
77 |
pField = p5.createInput(PROMPT_INPUT) // turns the string into an input; now access the text via PROMPT_INPUT.value()
|
78 |
pField.size(700)
|
79 |
+
pField.attribute('label', `Write a text prompt with one [MASK] that the model will fill in.`)
|
80 |
p5.createP(pField.attribute('label'))
|
81 |
pField.addClass("prompt")
|
82 |
+
// pField.value(PROMPT_INPUT)
|
83 |
+
// console.log(pField.value())
|
84 |
}
|
85 |
|
86 |
function makeButtons(){
|
|
|
93 |
async function displayResults(){
|
94 |
console.log('displayed, pressed')
|
95 |
|
96 |
+
PROMPT_INPUT = pField.value() // updates prompt if it's changed
|
97 |
+
console.log("latest prompt: ", PROMPT_INPUT)
|
98 |
|
99 |
let fillIn = await fillInTask(PROMPT_INPUT)
|
100 |
|