-
-
Save unitycoder/f24872f57f868eb37af99713d88f4abb to your computer and use it in GitHub Desktop.
Revisions
-
ausbitbank revised this gist
Oct 24, 2022 . 1 changed file with 0 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,17 +14,6 @@ socket.on("generationResult", (data) => { log(data) // data contains all the image data needed (params, filename etc) }) var imageOptions={ prompt: 'anon goes to space', iterations: 1, -
ausbitbank revised this gist
Oct 24, 2022 . 1 changed file with 24 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,10 +6,25 @@ socket.on("connect", (socket) => { log(socket) // Connected to api }) socket.on("progressUpdate", (data) => { log(data) // Returns current steps, status etc } socket.on("generationResult", (data) => { log(data) // data contains all the image data needed (params, filename etc) }) function initialImageUploaded(data){ var url=data.url var filename=config.basePath+"/"+data.url.replace('outputs/','')//.replace('/','\\') var id=data.url.split('/')[data.url.split('/').length-1].split('.')[0] var job = queue[id-1] if(job){ job.init_img=filename emitRenderApi(job) } } var imageOptions={ prompt: 'anon goes to space', iterations: 1, @@ -28,4 +43,12 @@ var imageOptions={ } var upscale=false // or an object like {level:2,strength:0.5} var facefix=false // or an object like {type:'codeformer',strength:1,codeformer_fidelity:1}} socket.emit('generateImage',imageOptions,upscale,facefix) // Send request, result comes via a "generationResult" reply // if you need to send an init image // "initimg" should contain a buffered file // Buffer.from(res.data) // socket.emit('uploadInitialImage', initimg, 'filename.png') // I pass an id via the filename to associate the returned result later socket.on("initialImageUploaded", (data) => { log(data) // Contains uploaded images new filename }) -
ausbitbank created this gist
Oct 24, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ const io = require("socket.io-client") const socket = io("http://127.0.0.1:9090",{reconnect: true}) const log = console.log.bind(console) socket.on("connect", (socket) => { log(socket) // Connected to api }) socket.on("generationResult", (data) => { log(data) // data contains all the image data needed (params, filename etc) }) var imageOptions={ prompt: 'anon goes to space', iterations: 1, steps: 50, cfg_scale: 7.5, threshold: 0, perlin: 0, sampler_name: 'k_lms', width: 512, height: 512, seed: 2977597109, progress_images: false, variation_amount: 0, strength: 0.75, fit: true } var upscale=false // or an object like {level:2,strength:0.5} var facefix=false // or an object like {type:'codeformer',strength:1,codeformer_fidelity:1}} socket.emit('generateImage',imageOptions,upscale,facefix) // Send request, result comes via a "generationResult" reply