Add files via upload

This commit is contained in:
taabata
2024-02-20 01:00:05 +03:00
committed by GitHub
parent 8776ab3076
commit 989ef242e8
6 changed files with 1522 additions and 0 deletions
+184
View File
@@ -0,0 +1,184 @@
from flask import Flask, render_template, request
from PIL import Image
import numpy as np
from flask_cors import CORS
import os, io, base64, glob, json, time, random
from urllib import request as rq
app = Flask(__name__)
CORS(app)
@app.route("/")
def index():
return render_template("mix.html")
@app.route("/stickerize",methods=["GET","POST"])
def stickerize():
imagedata = request.json["image"]
pixels = imagedata
if pixels != "":
for i in range(0,len(pixels)):
for j in range(0,len(pixels[i])):
pixels[i][j] = tuple(pixels[i][j])
array = np.array(pixels, dtype=np.uint8)
image = Image.fromarray(array)
image.save('image1.png')
list_of_files = glob.glob('../../../output/*')
latest_file = max(list_of_files, key=os.path.getctime)
def queue_prompt(prompt_workflow):
p = {"prompt": prompt_workflow}
data = json.dumps(p).encode('utf-8')
req = rq.Request("http://127.0.0.1:8188/prompt", data=data)
rq.urlopen(req)
prompt_workflow = json.load(open('./static/stickerize_api.json'))
prompt_workflow['36']['inputs']['image'] = os.path.join(os.getcwd(),"image1.png")
prompt_workflow['36']['inputs']['seed'] = random.randint(0,100000)
queue_prompt(prompt_workflow)
new_file = latest_file
while new_file == latest_file:
list_of_files = glob.glob('../../../output/*')
new_file = max(list_of_files, key=os.path.getctime)
time.sleep(1)
image = Image.open(f'../../../output/{os.path.basename(new_file)}')
buf = io.BytesIO()
image.save(buf, format='PNG')
byte_im = buf.getvalue()
byte_im = base64.b64encode(byte_im).decode('utf-8')
byte_im = f"data:image/png;base64,{byte_im}"
print(byte_im)
return {"byte_im":byte_im}
@app.route("/mix",methods=["GET","POST"])
def mix():
imagedata1 = request.json["image1"]
imagedata2 = request.json["image2"]
setting = request.json["setting"]
print(setting)
pixels = imagedata1
if pixels != "":
for i in range(0,len(pixels)):
for j in range(0,len(pixels[i])):
pixels[i][j] = tuple(pixels[i][j])
array = np.array(pixels, dtype=np.uint8)
image = Image.fromarray(array)
image.save('image1.png')
pixels = imagedata2
if pixels != "":
for i in range(0,len(pixels)):
for j in range(0,len(pixels[i])):
pixels[i][j] = tuple(pixels[i][j])
array = np.array(pixels, dtype=np.uint8)
image = Image.fromarray(array)
image.save('image2.png')
list_of_files = glob.glob('../../../output/*')
latest_file = max(list_of_files, key=os.path.getctime)
def queue_prompt(prompt_workflow):
p = {"prompt": prompt_workflow}
data = json.dumps(p).encode('utf-8')
req = rq.Request("http://127.0.0.1:8188/prompt", data=data)
rq.urlopen(req)
prompt_workflow = json.load(open('./static/mix_api.json'))
prompt_workflow['171']['inputs']['image'] = os.path.join(os.getcwd(),"image1.png")
prompt_workflow['171']['inputs']['seed'] = random.randint(0,100000)
prompt_workflow['172']['inputs']['image'] = os.path.join(os.getcwd(),"image2.png")
prompt_workflow['172']['inputs']['seed'] = random.randint(0,100000)
if setting == 1:
prompt_workflow['1']['inputs']['style_fidelity'] = 0.99
prompt_workflow['7']['inputs']['style_fidelity'] = 0.99
prompt_workflow['83']['inputs']['style_fidelity'] = 0.99
prompt_workflow['159']['inputs']['style_fidelity'] = 0.99
prompt_workflow['1']['inputs']['strength'] = 0.75
prompt_workflow['7']['inputs']['strength'] = 0.75
prompt_workflow['83']['inputs']['strength'] = 0.75
prompt_workflow['159']['inputs']['strength'] = 0.75
prompt_workflow['1']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['7']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['83']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['159']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['1']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['7']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['83']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['159']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['1']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['7']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['83']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['159']['inputs']['seed'] = random.randint(0,1000000000)
elif setting == 2:
prompt_workflow['1']['inputs']['style_fidelity'] = 0.99
prompt_workflow['7']['inputs']['style_fidelity'] = 0.99
prompt_workflow['83']['inputs']['style_fidelity'] = 0.99
prompt_workflow['159']['inputs']['style_fidelity'] = 0.99
prompt_workflow['1']['inputs']['strength'] = 0.75
prompt_workflow['7']['inputs']['strength'] = 0.75
prompt_workflow['83']['inputs']['strength'] = 0.75
prompt_workflow['159']['inputs']['strength'] = 0.75
prompt_workflow['1']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['7']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['83']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['159']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['1']['inputs']['controlnet_conditioning_scale'] = 0.24
prompt_workflow['7']['inputs']['controlnet_conditioning_scale'] = 0.24
prompt_workflow['83']['inputs']['controlnet_conditioning_scale'] = 0.24
prompt_workflow['159']['inputs']['controlnet_conditioning_scale'] = 0.24
prompt_workflow['1']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['7']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['83']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['159']['inputs']['seed'] = random.randint(0,1000000000)
elif setting ==3:
prompt_workflow['1']['inputs']['style_fidelity'] = 0.99
prompt_workflow['7']['inputs']['style_fidelity'] = 0.50
prompt_workflow['83']['inputs']['style_fidelity'] = 0.99
prompt_workflow['159']['inputs']['style_fidelity'] = 0.99
prompt_workflow['1']['inputs']['strength'] = 0.75
prompt_workflow['7']['inputs']['strength'] = 0.75
prompt_workflow['83']['inputs']['strength'] = 0.75
prompt_workflow['159']['inputs']['strength'] = 0.75
prompt_workflow['1']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['7']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['83']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['159']['inputs']['ipadapter_scale'] = 0.80
prompt_workflow['1']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['7']['inputs']['controlnet_conditioning_scale'] = 0.24
prompt_workflow['83']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['159']['inputs']['controlnet_conditioning_scale'] = 0.50
prompt_workflow['1']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['7']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['83']['inputs']['seed'] = random.randint(0,1000000000)
prompt_workflow['159']['inputs']['seed'] = random.randint(0,1000000000)
queue_prompt(prompt_workflow)
new_file = latest_file
while new_file == latest_file:
list_of_files = glob.glob('../../../output/*')
new_file = max(list_of_files, key=os.path.getctime)
time.sleep(1)
image = Image.open(f'../../../output/{os.path.basename(new_file)}')
buf = io.BytesIO()
image.save(buf, format='PNG')
byte_im = buf.getvalue()
byte_im = base64.b64encode(byte_im).decode('utf-8')
byte_im = f"data:image/png;base64,{byte_im}"
print(byte_im)
return {"byte_im":byte_im}
if __name__ == "__main__":
app.run(debug=True)
+166
View File
@@ -0,0 +1,166 @@
@keyframes changeprogressbar {
from{width: 30%;height: 10%;top: 85%;}
to{width: 40%;height: 5%;top: 80%;}
}
@keyframes progressbar {
0%{left: -5%;}
50%{left: 100%;}
100%{left:-5%;}
}
@keyframes appearcp {
from{top: 130%;}
to{top: 85%;}
}
@keyframes appearimg {
from{top: -30%;}
to{top: 30%;}
}
body{
background: linear-gradient(to bottom, #3B3486,#332941);
background-repeat: no-repeat;
background-attachment: fixed;
}
img,canvas{
box-shadow: 10px 10px 10px black;
position: absolute;
left: 50%;
top: 40%;
transform: translate(-50%,-50%);
visibility: hidden;
}
#cpcontainer{
position: fixed;
background: linear-gradient(to bottom, #F8E559 50%,#e2c90b 100%);
left: 50%;
top: 85%;
transform: translate(-50%,-50%);
border-radius: 10px;
width: 30%;
height: 10%;
box-shadow: 5px 5px 10px black;
overflow: hidden;
animation: appearcp 1s forwards;
}
#sticker div{
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-size: 150%;
font-weight: 1000;
color: #332941;
position: absolute;
left: 20%;
top: 50%;
}
#sticker{
position: absolute;
top: 50%;
left: 55%;
background-color: transparent;
width: 40%;
height: 80%;
cursor: pointer;
}
#cpcontainer *{
top: 50%;
transform: translate(0,-50%);
}
#inputimg{
position: absolute;
left: 50%;
top: 30%;
transform: translate(-50%,-50%);
width: 50%;
height: 50%;
animation: appearimg 1s forwards;
}
#inp{
opacity: 0;
width: 100%;
height: 100%;
}
#inplbl{
position: fixed;
background: grey;
left: 50%;
top: 85%;
transform: translate(-50%,-50%);
border-radius: 10px;
width: 100%;
height: 100%;
opacity: 0.25;
}
#settings{
position: absolute;
top: 50%;
left: 5%;
background-color: transparent;
width: 50%;
height: 80%;
}
.settings{
position: absolute;
top: 50%;
background-color: rgba(128, 128, 128, 0.2);
width: 20%;
height: 50%;
border-radius: 10px;
cursor: pointer;
transition: 1s;
}
.settings div{
position: absolute;
top: 50%;
left: 40%;
font-family: Verdana, Geneva, Tahoma, sans-serif;
font-size: 150%;
font-weight: 1000;
color: #332941;
}
#setting1{
left: 5%;
background-color: rgba(128, 128, 128, 0.4);
}
#setting2{
left: 35%;
}
#setting3{
left: 65%;
}
.settings:hover{
background-color: rgba(128, 128, 128, 0.4);
}
#sticker:hover{
text-shadow: -5px -5px 0 white, 5px -5px 0 white, -5px 5px 0 white, 5px 5px 0 white;
}
#progressanimation{
position: absolute;
left: -5%;
top: 50%;
width: 22%;
height: 90%;
background: linear-gradient(to left,transparent,white,transparent);
opacity: 0.6;
visibility: hidden;
}
+183
View File
@@ -0,0 +1,183 @@
var image = "";
var image1 = "";
var image2 = "";
var setting = 1;
var animationflag = false;
var animationdirection = false;
function select(evt){
evt.target.style.background = "rgba(128, 128, 128, 0.4)";
setting = parseInt(evt.target.id.slice(7));
console.log(setting);
for(let i = 0; i<3;i++){
if(evt.target.id != "setting1"){
document.getElementById("setting1").style.background = "rgba(128, 128, 128, 0.2)";
}
if(evt.target.id != "setting2"){
document.getElementById("setting2").style.background = "rgba(128, 128, 128, 0.2)";
}
if(evt.target.id != "setting3"){
document.getElementById("setting3").style.background = "rgba(128, 128, 128, 0.2)";
}
}
}
function changeimg(evt){
if(image!=""){
image1 = image;
}
document.getElementById("image").style.visibility = "visible";
document.getElementById("image").style.boxShadow = "10px 10px 10px black";
document.getElementById("inplbl").style.opacity = "0";
document.getElementById("image").src = URL.createObjectURL(evt.target.files[0]);
var img = new Image;
img.src = URL.createObjectURL(evt.target.files[0]);
img.onload = function(){
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(document.getElementById("image"), 0, 0);
data = ctx.getImageData(0, 0, canvas.width,canvas.height).data;
pxls = [];
for (let i = 0; i < data.length; i += 4) {
var pixel = [];
pixel.push(data[i]);
pixel.push(data[i+1]);
pixel.push(data[i+2]);
pixel.push(data[i+3]);
pxls.push(pixel);
}
var pxlsarray = [[]];
for(i = 0;i<pxls.length;i++){
pxlsarray[pxlsarray.length-1].push(pxls[i]);
if(i<pxls.length-2){
if((i+1)%canvas.width==0 && i>canvas.width-10){
pxlsarray.push([]);
}
}
}
image = pxlsarray;
if(image1!=""){
image2 = image;
mix();
}
}
}
function stickerize(){
document.getElementById("sticker").style.visibility = "hidden";
document.getElementById("settings").style.opacity = "0";
document.getElementById("cpcontainer").style.animation = null;
document.getElementById("cpcontainer").offsetHeight;
document.getElementById("cpcontainer").style.animation = "changeprogressbar 1s forwards";
setTimeout(() => {
document.getElementById("progressanimation").style.visibility = "visible";
document.getElementById("progressanimation").style.animation = null;
document.getElementById("progressanimation").offsetHeight;
document.getElementById("progressanimation").style.animation = "progressbar 1s infinite";
}, 1000);
fetch("http://localhost:5000/stickerize",{
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({"image":image})
}).
then(function (response) {
return response.json();
})
.then(data => {
document.getElementById("image").src = String(data["byte_im"]);
document.getElementById("image").style.boxShadow = "0px 0px 0px transparent";
image = "";
image1 = "";
image2 = "";
animationflag = true;
document.getElementById("progressanimation").style.visibility = "hidden";
document.getElementById("progressanimation").style.animation = null;
document.getElementById("progressanimation").offsetHeight;
document.getElementById("cpcontainer").style.animation = null;
document.getElementById("cpcontainer").offsetHeight;
document.getElementById("cpcontainer").style.animation = "changeprogressbar 1s reverse";
setTimeout(() => {
document.getElementById("settings").style.opacity = "1";
document.getElementById("sticker").style.visibility = "visible";
animationflag = false;
}, 1000);
})
}
function mix(){
document.getElementById("sticker").style.visibility = "hidden";
document.getElementById("settings").style.opacity = "0";
document.getElementById("cpcontainer").style.animation = null;
document.getElementById("cpcontainer").offsetHeight;
document.getElementById("cpcontainer").style.animation = "changeprogressbar 1s forwards";
setTimeout(() => {
document.getElementById("progressanimation").style.visibility = "visible";
document.getElementById("progressanimation").style.animation = null;
document.getElementById("progressanimation").offsetHeight;
document.getElementById("progressanimation").style.animation = "progressbar 1s infinite";
}, 1000);
fetch("http://localhost:5000/mix",{
method: 'POST',
headers: { "Content-Type": "application/json" },
body: JSON.stringify({"image1":image1,"image2":image2,"setting":setting})
}).
then(function (response) {
return response.json();
})
.then(data => {
document.getElementById("image").src = String(data["byte_im"]);
var img = new Image;
img.src = document.getElementById("image").src;
img.onload = function(){
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.drawImage(document.getElementById("image"), 0, 0);
data = ctx.getImageData(0, 0, canvas.width,canvas.height).data;
pxls = [];
for (let i = 0; i < data.length; i += 4) {
var pixel = [];
pixel.push(data[i]);
pixel.push(data[i+1]);
pixel.push(data[i+2]);
pixel.push(data[i+3]);
pxls.push(pixel);
}
var pxlsarray = [[]];
for(i = 0;i<pxls.length;i++){
pxlsarray[pxlsarray.length-1].push(pxls[i]);
if(i<pxls.length-2){
if((i+1)%canvas.width==0 && i>canvas.width-10){
pxlsarray.push([]);
}
}
}
image = pxlsarray;
}
image1 = "";
image2 = "";
animationflag = true;
document.getElementById("progressanimation").style.visibility = "hidden";
document.getElementById("progressanimation").style.animation = null;
document.getElementById("progressanimation").offsetHeight;
document.getElementById("cpcontainer").style.animation = null;
document.getElementById("cpcontainer").offsetHeight;
document.getElementById("cpcontainer").style.animation = "changeprogressbar 1s reverse";
setTimeout(() => {
document.getElementById("settings").style.opacity = "1";
document.getElementById("sticker").style.visibility = "visible";
animationflag = false;
}, 1000);
})
}
+699
View File
@@ -0,0 +1,699 @@
{
"1": {
"inputs": {
"seed": 0,
"prompt": "",
"negative_prompt": "",
"steps": 4,
"width": 512,
"height": 512,
"cfg": 1.5,
"style_fidelity": 0.5,
"strength": 1,
"batch": 1,
"ipadapter_scale": 0.6,
"controlnet_conditioning_scale": 0.6,
"reference_only": "enable",
"ip_adapter": "enable",
"control_net": "enable",
"pipe": [
"2",
0
],
"image": [
"22",
0
],
"control_image": [
"79",
0
],
"reference_image": [
"22",
0
],
"ipadapter_image": [
"22",
1
]
},
"class_type": "LCMLora_ipadapter"
},
"2": {
"inputs": {
"device": "GPU",
"tomesd_value": 0.6,
"ip_adapter_model": "ip-adapter_sd15.bin",
"reference_only": "enable",
"ip_adapter": "enable",
"control_net": "enable",
"model_name": "Juggernaut",
"controlnet_model": "cn_depth"
},
"class_type": "LCMLoraLoader_ipadapter"
},
"5": {
"inputs": {
"low_threshold": 100,
"high_threshold": 200,
"resolution": 512
},
"class_type": "CannyEdgePreprocessor"
},
"7": {
"inputs": {
"seed": 0,
"prompt": "",
"negative_prompt": "",
"steps": 4,
"width": 512,
"height": 512,
"cfg": 1.5,
"style_fidelity": 0.5,
"strength": 1,
"batch": 1,
"ipadapter_scale": 0.6,
"controlnet_conditioning_scale": 0.6,
"reference_only": "enable",
"ip_adapter": "enable",
"control_net": "enable",
"pipe": [
"2",
0
],
"image": [
"22",
1
],
"control_image": [
"80",
0
],
"reference_image": [
"22",
1
],
"ipadapter_image": [
"13",
0
]
},
"class_type": "LCMLora_ipadapter"
},
"11": {
"inputs": {
"low_threshold": 100,
"high_threshold": 200,
"resolution": 512
},
"class_type": "CannyEdgePreprocessor"
},
"13": {
"inputs": {
"image": [
"1",
0
]
},
"class_type": "ImageOutputToComfyNodes"
},
"18": {
"inputs": {
"stitch": "right",
"feathering": 0,
"image_a": [
"22",
0
],
"image_b": [
"22",
1
]
},
"class_type": "Image Stitch"
},
"19": {
"inputs": {
"stitch": "bottom",
"feathering": 0,
"image_a": [
"18",
0
],
"image_b": [
"20",
0
]
},
"class_type": "Image Stitch"
},
"20": {
"inputs": {
"stitch": "right",
"feathering": 0,
"image_a": [
"13",
0
],
"image_b": [
"21",
0
]
},
"class_type": "Image Stitch"
},
"21": {
"inputs": {
"image": [
"7",
0
]
},
"class_type": "ImageOutputToComfyNodes"
},
"22": {
"inputs": {
"switch": "disable",
"image_1": [
"169",
0
],
"image_2": [
"170",
0
]
},
"class_type": "ImageSwitch"
},
"23": {
"inputs": {
"sf_1": 0.6,
"sf_2": 0.6,
"sf_3": 0.6,
"strength_1": 0.6,
"strength_2": 0.6,
"strength_3": 0.6,
"IPAScale_1": 0.6,
"IPAScale_2": 0.6,
"IPAScale_3": 0.6,
"CNScale_1": 0.6,
"CNScale_2": 0.6,
"CNScale_3": 0.6,
"setting": "v3"
},
"class_type": "SettingsSwitch"
},
"26": {
"inputs": {
"Number": 0.8
},
"class_type": "FloatNumber"
},
"27": {
"inputs": {
"Number": 0.8200000000000001
},
"class_type": "FloatNumber"
},
"28": {
"inputs": {
"Number": 0.3
},
"class_type": "FloatNumber"
},
"29": {
"inputs": {
"Number": 0.7000000000000001
},
"class_type": "FloatNumber"
},
"30": {
"inputs": {
"Number": 0.25
},
"class_type": "FloatNumber"
},
"31": {
"inputs": {
"Number": 0.05
},
"class_type": "FloatNumber"
},
"32": {
"inputs": {
"Number": 0.07
},
"class_type": "FloatNumber"
},
"33": {
"inputs": {
"Number": 0.08
},
"class_type": "FloatNumber"
},
"34": {
"inputs": {
"Number": 0.55
},
"class_type": "FloatNumber"
},
"35": {
"inputs": {
"Number": 0.1
},
"class_type": "FloatNumber"
},
"36": {
"inputs": {
"Number": 0.65
},
"class_type": "FloatNumber"
},
"37": {
"inputs": {
"Number": 0.9
},
"class_type": "FloatNumber"
},
"38": {
"inputs": {
"sf_1": 0.6,
"sf_2": 0.6,
"sf_3": 0.6,
"strength_1": 0.6,
"strength_2": 0.6,
"strength_3": 0.6,
"IPAScale_1": 0.6,
"IPAScale_2": 0.6,
"IPAScale_3": 0.6,
"CNScale_1": 0.6,
"CNScale_2": 0.6,
"CNScale_3": 0.6,
"setting": "v1"
},
"class_type": "SettingsSwitch"
},
"39": {
"inputs": {
"Number": 0.73
},
"class_type": "FloatNumber"
},
"40": {
"inputs": {
"Number": 0.2
},
"class_type": "FloatNumber"
},
"41": {
"inputs": {
"Number": 0.85
},
"class_type": "FloatNumber"
},
"42": {
"inputs": {
"Number": 0.72
},
"class_type": "FloatNumber"
},
"43": {
"inputs": {
"Number": 0.88
},
"class_type": "FloatNumber"
},
"44": {
"inputs": {
"Number": 0.1
},
"class_type": "FloatNumber"
},
"45": {
"inputs": {
"Number": 0.09
},
"class_type": "FloatNumber"
},
"46": {
"inputs": {
"Number": 0.85
},
"class_type": "FloatNumber"
},
"47": {
"inputs": {
"sf_1": 0.6,
"sf_2": 0.6,
"sf_3": 0.6,
"strength_1": 0.6,
"strength_2": 0.6,
"strength_3": 0.6,
"IPAScale_1": 0.6,
"IPAScale_2": 0.6,
"IPAScale_3": 0.6,
"CNScale_1": 0.6,
"CNScale_2": 0.6,
"CNScale_3": 0.6,
"setting": "v3"
},
"class_type": "SettingsSwitch"
},
"48": {
"inputs": {
"Number": 0.45
},
"class_type": "FloatNumber"
},
"49": {
"inputs": {
"Number": 0.8200000000000001
},
"class_type": "FloatNumber"
},
"50": {
"inputs": {
"Number": 0.96
},
"class_type": "FloatNumber"
},
"51": {
"inputs": {
"Number": 0.04
},
"class_type": "FloatNumber"
},
"59": {
"inputs": {
"Number": 0.99
},
"class_type": "FloatNumber"
},
"60": {
"inputs": {
"Number": 0.75
},
"class_type": "FloatNumber"
},
"61": {
"inputs": {
"Number": 0.8
},
"class_type": "FloatNumber"
},
"62": {
"inputs": {
"Number": 0.5
},
"class_type": "FloatNumber"
},
"64": {
"inputs": {
"Number": 0.06
},
"class_type": "FloatNumber"
},
"76": {
"inputs": {
"a": 6.28,
"bg_threshold": 0.1,
"resolution": 512
},
"class_type": "MiDaS-DepthMapPreprocessor"
},
"77": {
"inputs": {
"a": 6.28,
"bg_threshold": 0.1,
"resolution": 512
},
"class_type": "MiDaS-DepthMapPreprocessor"
},
"79": {
"inputs": {
"rm_nearest": 0,
"rm_background": 0,
"boost": "disable",
"resolution": 512,
"image": [
"22",
0
]
},
"class_type": "LeReS-DepthMapPreprocessor"
},
"80": {
"inputs": {
"rm_nearest": 0,
"rm_background": 0,
"boost": "disable",
"resolution": 512,
"image": [
"22",
1
]
},
"class_type": "LeReS-DepthMapPreprocessor"
},
"81": {
"inputs": {
"Number": 0.8
},
"class_type": "FloatNumber"
},
"83": {
"inputs": {
"seed": 0,
"prompt": "",
"negative_prompt": "",
"steps": 2,
"width": 512,
"height": 512,
"cfg": 1.5,
"style_fidelity": 0.5,
"strength": 1,
"batch": 1,
"ipadapter_scale": 0.6,
"controlnet_conditioning_scale": 0.6,
"reference_only": "enable",
"ip_adapter": "enable",
"control_net": "enable",
"pipe": [
"2",
0
],
"image": [
"84",
0
],
"control_image": [
"85",
0
],
"reference_image": [
"84",
0
],
"ipadapter_image": [
"22",
1
]
},
"class_type": "LCMLora_ipadapter"
},
"84": {
"inputs": {
"image": [
"7",
0
]
},
"class_type": "ImageOutputToComfyNodes"
},
"85": {
"inputs": {
"rm_nearest": 0,
"rm_background": 0,
"boost": "disable",
"resolution": 512,
"image": [
"84",
0
]
},
"class_type": "LeReS-DepthMapPreprocessor"
},
"86": {
"inputs": {
"Number": 0.5
},
"class_type": "FloatNumber"
},
"87": {
"inputs": {
"Number": 0.75
},
"class_type": "FloatNumber"
},
"88": {
"inputs": {
"Number": 0.28
},
"class_type": "FloatNumber"
},
"89": {
"inputs": {
"Number": 0.65
},
"class_type": "FloatNumber"
},
"92": {
"inputs": {
"number_type": "integer",
"minimum": 0,
"maximum": 1000000000,
"seed": 595187789626548
},
"class_type": "Random Number"
},
"159": {
"inputs": {
"seed": 0,
"prompt": "",
"negative_prompt": "",
"steps": 4,
"width": 512,
"height": 512,
"cfg": 1.5,
"style_fidelity": 0.5,
"strength": 1,
"batch": 1,
"ipadapter_scale": 0.6,
"controlnet_conditioning_scale": 0.6,
"reference_only": "enable",
"ip_adapter": "enable",
"control_net": "enable",
"pipe": [
"2",
0
],
"image": [
"160",
0
],
"control_image": [
"161",
0
],
"reference_image": [
"160",
0
],
"ipadapter_image": [
"22",
0
]
},
"class_type": "LCMLora_ipadapter"
},
"160": {
"inputs": {
"image": [
"83",
0
]
},
"class_type": "ImageOutputToComfyNodes"
},
"161": {
"inputs": {
"rm_nearest": 0,
"rm_background": 0,
"boost": "disable",
"resolution": 512,
"image": [
"160",
0
]
},
"class_type": "LeReS-DepthMapPreprocessor"
},
"162": {
"inputs": {
"Number": 0.5
},
"class_type": "FloatNumber"
},
"163": {
"inputs": {
"Number": 0.9
},
"class_type": "FloatNumber"
},
"164": {
"inputs": {
"Number": 0.28
},
"class_type": "FloatNumber"
},
"165": {
"inputs": {
"Number": 0.65
},
"class_type": "FloatNumber"
},
"166": {
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"159",
0
]
},
"class_type": "SaveImage_LCM"
},
"169": {
"inputs": {
"mode": "resize",
"supersample": "true",
"resampling": "lanczos",
"rescale_factor": 2,
"resize_width": 512,
"resize_height": 512,
"image": [
"171",
0
]
},
"class_type": "Image Resize"
},
"170": {
"inputs": {
"mode": "resize",
"supersample": "true",
"resampling": "lanczos",
"rescale_factor": 2,
"resize_width": 512,
"resize_height": 512,
"image": [
"172",
0
]
},
"class_type": "Image Resize"
},
"171": {
"inputs": {
"image": "/home/mohammad/ComfyUI/custom_nodes/LCM_Inpaint-Outpaint_Comfy/mixture/image1.png",
"seed": 3521
},
"class_type": "LoadImageNode_LCM"
},
"172": {
"inputs": {
"image": "/home/mohammad/ComfyUI/custom_nodes/LCM_Inpaint-Outpaint_Comfy/mixture/image2.png",
"seed": 8874
},
"class_type": "LoadImageNode_LCM"
}
}
+258
View File
@@ -0,0 +1,258 @@
{
"3": {
"inputs": {},
"class_type": "BRIA_RMBG_ModelLoader_Zho"
},
"5": {
"inputs": {
"force_resize_width": 0,
"force_resize_height": 0,
"image": [
"30",
0
],
"mask": [
"28",
0
]
},
"class_type": "Cut By Mask"
},
"8": {
"inputs": {
"channel": "red",
"image": [
"22",
0
]
},
"class_type": "ImageToMask"
},
"10": {
"inputs": {
"expand": 40,
"tapered_corners": true,
"mask": [
"8",
0
]
},
"class_type": "GrowMask"
},
"11": {
"inputs": {
"width": 2108,
"height": 2108,
"batch_size": 1,
"color": 0
},
"class_type": "EmptyImage"
},
"12": {
"inputs": {
"top": 40,
"left": 40,
"right": 2088,
"bottom": 2088,
"crop_blending": 0,
"crop_sharpening": 0,
"image": [
"11",
0
],
"crop_image": [
"35",
0
]
},
"class_type": "Image Paste Crop by Location"
},
"15": {
"inputs": {
"images": [
"12",
0
]
},
"class_type": "PreviewImage"
},
"16": {
"inputs": {
"filename_prefix": "ComfyUI",
"images": [
"5",
0
]
},
"class_type": "SaveImage"
},
"17": {
"inputs": {
"rmbgmodel": [
"3",
0
],
"image": [
"12",
0
]
},
"class_type": "BRIA_RMBG_Zho"
},
"18": {
"inputs": {
"images": [
"17",
0
]
},
"class_type": "PreviewImage"
},
"20": {
"inputs": {
"mask": [
"17",
1
]
},
"class_type": "MaskToImage"
},
"21": {
"inputs": {
"images": [
"20",
0
]
},
"class_type": "PreviewImage"
},
"22": {
"inputs": {
"bin_threshold": 100,
"resolution": 2048,
"image": [
"20",
0
]
},
"class_type": "BinaryPreprocessor"
},
"23": {
"inputs": {
"sigma": 10,
"masks": [
"10",
0
]
},
"class_type": "Mask Smooth Region"
},
"25": {
"inputs": {
"images": [
"22",
0
]
},
"class_type": "PreviewImage"
},
"26": {
"inputs": {
"images": [
"27",
0
]
},
"class_type": "PreviewImage"
},
"27": {
"inputs": {
"mask": [
"8",
0
]
},
"class_type": "MaskToImage"
},
"28": {
"inputs": {
"mask": [
"23",
0
]
},
"class_type": "MaskToImage"
},
"29": {
"inputs": {
"images": [
"28",
0
]
},
"class_type": "PreviewImage"
},
"30": {
"inputs": {
"top": 20,
"left": 20,
"right": 2068,
"bottom": 2068,
"crop_blending": 0,
"crop_sharpening": 0,
"image": [
"28",
0
],
"crop_image": [
"17",
0
]
},
"class_type": "Image Paste Crop by Location"
},
"31": {
"inputs": {
"images": [
"30",
0
]
},
"class_type": "PreviewImage"
},
"32": {
"inputs": {
"images": [
"5",
0
]
},
"class_type": "PreviewImage"
},
"34": {
"inputs": {
"model_name": "realesr-general-x4v3.pth"
},
"class_type": "UpscaleModelLoader"
},
"35": {
"inputs": {
"upscale_model": [
"34",
0
],
"image": [
"36",
0
]
},
"class_type": "ImageUpscaleWithModel"
},
"36": {
"inputs": {
"image": "/home/mohammad/ComfyUI/custom_nodes/LCM_Inpaint-Outpaint_Comfy/mixture/image1.png",
"seed": 0
},
"class_type": "LoadImageNode_LCM"
}
}
+32
View File
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/mix.css">
</head>
<body>
<script src="/static/mix.js"></script>
<canvas id="canvas" width=512 height=512></canvas>
<img id="image" width="512" height="512" src="/static/images/test.png">
<div id="inputimg">
<label for="inp" id="inplbl"></label>
<input type="file" id="inp" onchange="changeimg(event);">
</div>
<div id="cpcontainer">
<div id="settings">
<div id="setting1" class="settings" onclick="select(event);">
<div>1</div>
</div>
<div id="setting2" class="settings" onclick="select(event);">
<div>2</div>
</div>
<div id="setting3" class="settings" onclick="select(event);">
<div>3</div>
</div>
</div>
<div id="sticker" onclick="stickerize();">
<div>STICKERIZE</div>
</div>
<div id="progressanimation"></div>
</div>
</body>
</html>