Spaces:
Running
Running
fix prompt concat string?, fix image json handling?
Browse files
sketch.js
CHANGED
@@ -30,6 +30,8 @@ var blanksArray = [] // an empty list to store all the variables we enter to mod
|
|
30 |
// }
|
31 |
|
32 |
async function textImgTask(prompt){
|
|
|
|
|
33 |
const URL = 'https://multimodalart-flux-1-merged.hf.space/call/infer'
|
34 |
const seed = 0
|
35 |
const randomizeSeed = true
|
@@ -47,11 +49,13 @@ async function textImgTask(prompt){
|
|
47 |
}
|
48 |
})
|
49 |
|
|
|
|
|
50 |
let data = await res.json()
|
51 |
|
52 |
console.log(data)
|
53 |
|
54 |
-
let out = await data[
|
55 |
|
56 |
return out
|
57 |
}
|
@@ -66,7 +70,8 @@ async function textGenTask(pre, prompts){
|
|
66 |
|
67 |
// Create concatenated prompt array including preprompt and all variable prompts
|
68 |
// let promptArray = []
|
69 |
-
let PROMPTS =
|
|
|
70 |
|
71 |
// // Fill in blanks from our sample prompt and make new prompts using our variable list 'blanksArray'
|
72 |
// blanks.forEach(b => {
|
@@ -290,7 +295,8 @@ new p5(function (p5){
|
|
290 |
await outText.html(outs, false) // false valuereplaces text, true appends text
|
291 |
|
292 |
let outPic = await textImgTask(promptArray)
|
293 |
-
|
|
|
294 |
}
|
295 |
|
296 |
p5.draw = function(){
|
|
|
30 |
// }
|
31 |
|
32 |
async function textImgTask(prompt){
|
33 |
+
console.log('text-to-image task initiated')
|
34 |
+
|
35 |
const URL = 'https://multimodalart-flux-1-merged.hf.space/call/infer'
|
36 |
const seed = 0
|
37 |
const randomizeSeed = true
|
|
|
49 |
}
|
50 |
})
|
51 |
|
52 |
+
console.log(res)
|
53 |
+
|
54 |
let data = await res.json()
|
55 |
|
56 |
console.log(data)
|
57 |
|
58 |
+
let out = await data[1]
|
59 |
|
60 |
return out
|
61 |
}
|
|
|
70 |
|
71 |
// Create concatenated prompt array including preprompt and all variable prompts
|
72 |
// let promptArray = []
|
73 |
+
let PROMPTS = pre.concat(prompts) //adds the preprompt to the front of the prompts list
|
74 |
+
console.log(PROMPTS)
|
75 |
|
76 |
// // Fill in blanks from our sample prompt and make new prompts using our variable list 'blanksArray'
|
77 |
// blanks.forEach(b => {
|
|
|
295 |
await outText.html(outs, false) // false valuereplaces text, true appends text
|
296 |
|
297 |
let outPic = await textImgTask(promptArray)
|
298 |
+
console.log(outPic)
|
299 |
+
p5.createImage(outPic.url)
|
300 |
}
|
301 |
|
302 |
p5.draw = function(){
|