Spaces:
Running
Running
new chain order
Browse files
index.js
CHANGED
|
@@ -6,9 +6,9 @@ import { pipeline, env } from 'https://cdn.jsdelivr.net/npm/@xenova/transformers
|
|
| 6 |
env.allowLocalModels = false;
|
| 7 |
|
| 8 |
// GLOBAL VARIABLES
|
| 9 |
-
let PROMPT_INPUT = `
|
| 10 |
let OUTPUT_LIST = [] // a blank array to store the results from the model
|
| 11 |
-
|
| 12 |
|
| 13 |
// RUN MODEL
|
| 14 |
async function fillInTask(input){
|
|
@@ -51,10 +51,6 @@ async function getOutputs(task){
|
|
| 51 |
|
| 52 |
// await getOutputs(fillInTask()) // getOutputs will later connect to the interface to display results
|
| 53 |
|
| 54 |
-
let fillIn = await fillInTask(PROMPT_INPUT)
|
| 55 |
-
|
| 56 |
-
let outs = await getOutputs(fillIn)
|
| 57 |
-
|
| 58 |
console.log(outs)
|
| 59 |
|
| 60 |
//// p5.js Instance
|
|
@@ -78,7 +74,7 @@ new p5(function (p5){
|
|
| 78 |
}
|
| 79 |
|
| 80 |
function makeFields(){
|
| 81 |
-
|
| 82 |
pField.size(700)
|
| 83 |
pField.attribute('label', `Write a text prompt with at least one [MASK] that the model will fill in.`)
|
| 84 |
p5.createP(pField.attribute('label'))
|
|
@@ -91,15 +87,22 @@ new p5(function (p5){
|
|
| 91 |
let submitButton = p5.createButton("SUBMIT")
|
| 92 |
submitButton.size(170)
|
| 93 |
submitButton.class('submit')
|
| 94 |
-
submitButton.mousePressed(
|
| 95 |
}
|
| 96 |
|
| 97 |
-
async function displayResults(
|
| 98 |
console.log('displayed or pressed')
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
await
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
}
|
| 104 |
|
| 105 |
// async function makeOutputDisplay(){
|
|
|
|
| 6 |
env.allowLocalModels = false;
|
| 7 |
|
| 8 |
// GLOBAL VARIABLES
|
| 9 |
+
let PROMPT_INPUT = `Happy people don't [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 |
|
| 13 |
// RUN MODEL
|
| 14 |
async function fillInTask(input){
|
|
|
|
| 51 |
|
| 52 |
// await getOutputs(fillInTask()) // getOutputs will later connect to the interface to display results
|
| 53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
console.log(outs)
|
| 55 |
|
| 56 |
//// p5.js Instance
|
|
|
|
| 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 at least one [MASK] that the model will fill in.`)
|
| 80 |
p5.createP(pField.attribute('label'))
|
|
|
|
| 87 |
let submitButton = p5.createButton("SUBMIT")
|
| 88 |
submitButton.size(170)
|
| 89 |
submitButton.class('submit')
|
| 90 |
+
// submitButton.mousePressed()
|
| 91 |
}
|
| 92 |
|
| 93 |
+
async function displayResults(){
|
| 94 |
console.log('displayed or pressed')
|
| 95 |
+
|
| 96 |
+
// PROMPT_INPUT = pField.value()
|
| 97 |
+
|
| 98 |
+
let fillIn = await fillInTask(PROMPT_INPUT)
|
| 99 |
+
|
| 100 |
+
let outs = await getOutputs(fillIn)
|
| 101 |
+
|
| 102 |
+
// text = str(outs)
|
| 103 |
+
// let outHeader = p5.createElement('h3',"Results")
|
| 104 |
+
// let outText = p5.createP('')
|
| 105 |
+
// await outText.html(text)
|
| 106 |
}
|
| 107 |
|
| 108 |
// async function makeOutputDisplay(){
|