Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b3e21ac98e | ||
|
|
9aaa894a2b | ||
|
|
685e225d85 | ||
|
|
dfd130c595 | ||
|
|
d81449fc12 | ||
|
|
a538f7d379 | ||
|
|
c1f0138fc7 | ||
|
|
bdb9a99c90 | ||
|
|
f8396e9a1b | ||
|
|
08b16d4efb | ||
|
|
c1ba8164fc | ||
|
|
587cac06af | ||
|
|
0659bfb2e7 |
+3
-46
@@ -173,10 +173,6 @@ async function prepareImageFromUrlRedirect(stage) {
|
||||
|
||||
export function AvatarPreview() {
|
||||
console.log("getting workflow json now");
|
||||
loadJSONWorkflow("default").then(() => {
|
||||
console.log("done loading");
|
||||
jsonWorkflowLoading.val = false;
|
||||
});
|
||||
|
||||
const loading = van.state(false);
|
||||
const shareLoading = van.state("share"); // share, loading, shared
|
||||
@@ -465,7 +461,7 @@ export function AvatarPreview() {
|
||||
name: "avatech-viewer-iframe",
|
||||
allow: "cross-origin-isolated",
|
||||
class: () =>
|
||||
"w-full h-full min-w-[400px] min-h-[400px] z-[100] pointer-events-auto flex border-none overflow-hidden" +
|
||||
"w-full h-full min-w-[350px] min-h-[350px] z-[100] pointer-events-auto flex border-none overflow-hidden bg-transparent" +
|
||||
(showPreview.val ? "" : "hidden"),
|
||||
// src: "https://labs.avatech.ai/viewer/default",
|
||||
// src: "http://localhost:3000/viewer/default",
|
||||
@@ -711,50 +707,11 @@ export function AvatarPreview() {
|
||||
|
||||
return (
|
||||
(showPreview.val ? "" : "hidden ") +
|
||||
"w-full h-full absolute left-0 top-0 z-[99] pointer-events-auto flex border-none bg-white"
|
||||
"absolute w-[360px] h-[360px] rounded-xl overflow-hidden right-0 top-0 z-[99] pointer-events-auto flex border-none bg-transparent"
|
||||
);
|
||||
},
|
||||
},
|
||||
div(
|
||||
{ class: "overflow-y-auto overflow-x-hidden w-full h-full" },
|
||||
div(
|
||||
{
|
||||
class: "absolute top-4 left-4 flex flex-row gap-2",
|
||||
},
|
||||
renderCloseButton(),
|
||||
renderRestartButton(),
|
||||
renderChangeWorkflowButton()
|
||||
),
|
||||
renderTwitter(),
|
||||
() => {
|
||||
if (isMobileDevice()) {
|
||||
return div(
|
||||
{
|
||||
class: () =>
|
||||
"flex flex-col w-full h-fit bg-white justify-center items-center py-16 px-4 gap-2" +
|
||||
(showPreview.val ? "" : "hidden"),
|
||||
},
|
||||
renderIFrame(),
|
||||
renderSteps(),
|
||||
renderShareLink()
|
||||
);
|
||||
} else {
|
||||
return div(
|
||||
{
|
||||
class: () =>
|
||||
"flex w-full h-full bg-white justify-around items-center p-24" +
|
||||
(showPreview.val ? "" : "hidden"),
|
||||
},
|
||||
renderSteps(),
|
||||
div(
|
||||
{ class: () => "flex flex-col" },
|
||||
renderIFrame(),
|
||||
renderShareLink()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
)
|
||||
renderIFrame(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
import { combinePointsNode, samPrompts } from "./state.js";
|
||||
import { van } from "./van.js";
|
||||
const { div, dialog, form, button, h3, input, span } = van.tags;
|
||||
|
||||
van.derive(() => {
|
||||
if (
|
||||
combinePointsNode.val != undefined &&
|
||||
combinePointsNode.val.type === "Combine Points"
|
||||
) {
|
||||
const inputNames =
|
||||
combinePointsNode.val.inputs?.map((x) => x.name).slice(1) || [];
|
||||
const record = Object.keys(samPrompts.val);
|
||||
|
||||
const missingDiff = record.filter((x) => !inputNames.includes(x));
|
||||
|
||||
if (missingDiff.length > 0) {
|
||||
missingDiff.forEach((x) => {
|
||||
combinePointsNode.val.addInput(x, "POINTS");
|
||||
});
|
||||
combinePointsNode.val.graph.change();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
export function CombinePointsDialog() {
|
||||
const showAddLayer = van.state(false);
|
||||
|
||||
return div(
|
||||
{
|
||||
class: () =>
|
||||
"absolute z-[100] top-0 left-0 flex justify-center w-full h-full ",
|
||||
},
|
||||
() =>
|
||||
dialog(
|
||||
{ id: "combine_points_dialog", class: "modal" },
|
||||
div(
|
||||
{ class: "modal-box text-base-content" },
|
||||
form(
|
||||
{
|
||||
class: "gap-2 flex flex-col",
|
||||
method: "dialog",
|
||||
onsubmit: (e) => {
|
||||
e.preventDefault();
|
||||
combine_points_dialog.close();
|
||||
},
|
||||
},
|
||||
button(
|
||||
{
|
||||
type: "button",
|
||||
class: "btn btn-sm btn-circle btn-ghost absolute right-2 top-2",
|
||||
onclick: (e) => {
|
||||
e.stopPropagation();
|
||||
combine_points_dialog.close();
|
||||
},
|
||||
},
|
||||
"✕"
|
||||
),
|
||||
h3({ class: "font-bold text-lg text-base-content" }, "Edit points"),
|
||||
() =>
|
||||
div(
|
||||
{ class: "flex flex-col gap-2 mb-2" },
|
||||
...Object.keys(samPrompts.val).map((key) => {
|
||||
return span(key);
|
||||
})
|
||||
),
|
||||
|
||||
() =>
|
||||
showAddLayer.val
|
||||
? div(
|
||||
{
|
||||
class:
|
||||
"flex flex-row justify-center items-center border rounded-md pr-2",
|
||||
},
|
||||
input({
|
||||
type: "text",
|
||||
placeholder: "Type here",
|
||||
id: "layerName",
|
||||
class:
|
||||
"input input-ghost w-full focus:ring-0 focus:border-none focus:outline-none",
|
||||
autofocus: true,
|
||||
}),
|
||||
button(
|
||||
{
|
||||
onclick: (e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
showAddLayer.val = false;
|
||||
},
|
||||
},
|
||||
span({
|
||||
class: "iconify text-2xl",
|
||||
"data-icon": "iconoir:cancel",
|
||||
})
|
||||
),
|
||||
button(
|
||||
{
|
||||
onclick: (e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
showAddLayer.val = false;
|
||||
const inputText =
|
||||
document.getElementById("layerName").value;
|
||||
samPrompts.val = {
|
||||
...samPrompts.val,
|
||||
[inputText]: [],
|
||||
};
|
||||
},
|
||||
},
|
||||
span({
|
||||
class: "iconify text-2xl",
|
||||
"data-icon": "mdi:tick",
|
||||
})
|
||||
)
|
||||
)
|
||||
: button(
|
||||
{
|
||||
class: "btn btn-outline btn",
|
||||
onclick: (e) => {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
showAddLayer.val = true;
|
||||
},
|
||||
},
|
||||
"Add new layer"
|
||||
),
|
||||
button(
|
||||
{
|
||||
type: "submit",
|
||||
class: "btn btn-sm btn-ghost place-self-end",
|
||||
},
|
||||
"Confirm"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
+9
-11
@@ -1,20 +1,18 @@
|
||||
import { LayerEditor } from "./LayerEditor.js";
|
||||
import { ShapeFlowEditor } from "./ShapeFlowEditor.js";
|
||||
import { van } from "./van.js";
|
||||
import { AvatarPreview } from "./AvatarPreview.js";
|
||||
import { Loading } from "./Loading.js";
|
||||
import { Alert } from "./Alert.js";
|
||||
import { AppHeader } from "./AppHeader.js";
|
||||
import { CombinePointsDialog } from "./CombinePointsDialog.js";
|
||||
import { LayerEditor } from './LayerEditor.js';
|
||||
import { ShapeFlowEditor } from './ShapeFlowEditor.js';
|
||||
import { van } from './van.js';
|
||||
import { AvatarPreview } from './AvatarPreview.js';
|
||||
import { Loading } from './Loading.js';
|
||||
import { Alert } from './Alert.js';
|
||||
import { AppHeader } from './AppHeader.js';
|
||||
const { button, iframe, div, img } = van.tags;
|
||||
|
||||
export function Container() {
|
||||
return div(
|
||||
{
|
||||
class: "fixed left-0 top-0 w-full h-full z-[1000] pointer-events-none",
|
||||
id: "avatech-editor",
|
||||
class: 'fixed left-0 top-0 w-full h-full z-[1000] pointer-events-none',
|
||||
id: 'avatech-editor',
|
||||
},
|
||||
CombinePointsDialog(),
|
||||
ShapeFlowEditor(),
|
||||
LayerEditor(),
|
||||
AvatarPreview(),
|
||||
|
||||
+4
-35
@@ -5,7 +5,6 @@ import {
|
||||
imageUrl,
|
||||
imagePrompts,
|
||||
targetNode,
|
||||
combinePointsNode,
|
||||
fileName,
|
||||
embeddings,
|
||||
imagePromptsMulti,
|
||||
@@ -390,16 +389,6 @@ const ext = {
|
||||
widget: btn,
|
||||
};
|
||||
},
|
||||
COMBINE_POINTS(node, inputName, inputData, app) {
|
||||
const btn = node.addWidget("button", "Edit points", "", () => {
|
||||
console.log("Edit points");
|
||||
combine_points_dialog.showModal();
|
||||
combinePointsNode.val = node;
|
||||
});
|
||||
return {
|
||||
widget: btn,
|
||||
};
|
||||
},
|
||||
BLENDSHAPES_CONFIG(node, inputName, inputData, app) {
|
||||
const btn = node.addWidget("button", "Edit Shape Flow", "", () => {
|
||||
targetNode.val = node;
|
||||
@@ -686,18 +675,6 @@ const ext = {
|
||||
nodeData.input.required.sam = ["SAM_PROMPTS"];
|
||||
// nodeData.input.required.upload = ['IMAGEUPLOAD'];
|
||||
// nodeData.input.required.prompts_points = ["IMAGEUPLOAD"];
|
||||
addMenuHandler(nodeType, function (_, options) {
|
||||
options.unshift({
|
||||
content: "Open In Points Editor (Local)",
|
||||
callback: () => {
|
||||
showMyImageEditor(this);
|
||||
},
|
||||
});
|
||||
});
|
||||
break;
|
||||
case "Combine Points":
|
||||
nodeData.input.required.sam = ["COMBINE_POINTS"];
|
||||
|
||||
addMenuHandler(nodeType, function (_, options) {
|
||||
options.unshift({
|
||||
content: "Open In Points Editor (Local)",
|
||||
@@ -769,19 +746,11 @@ function injectUIComponentToComfyuimenu() {
|
||||
if (!filename.toLowerCase().endsWith(".json")) {
|
||||
filename += ".json";
|
||||
}
|
||||
app.graphToPrompt().then((p) => {
|
||||
app.graphToPrompt().then(p=>{
|
||||
console.log('fkfk');
|
||||
let json = JSON.stringify(p.output, null, 2); // convert the data to a JSON string
|
||||
json = json
|
||||
.replace(/"seed": (\d+)/g, `"seed": "SEED"`)
|
||||
.replace(
|
||||
/"image": "(?!.*mask.*\.png).*"/g,
|
||||
'"image": "reference_image_avatech"'
|
||||
)
|
||||
.replace(
|
||||
/"embedding_id": ".*"/g,
|
||||
'"embedding_id": "embedding_id_avatech"'
|
||||
);
|
||||
const blob = new Blob([json], { type: "application/json" });
|
||||
json = json.replace(/"seed": (\d+)/g, `"seed": "SEED"`).replace(/"image": "(?!.*mask.*\.png).*"/g, '"image": "reference_image_avatech"').replace(/"embedding_id": ".*"/g, '"embedding_id": "embedding_id_avatech"');
|
||||
const blob = new Blob([json], {type: "application/json"});
|
||||
const url = URL.createObjectURL(blob);
|
||||
a.href = url;
|
||||
a.download = filename;
|
||||
|
||||
+2
-5
@@ -25,7 +25,7 @@ export const showEditor = van.state(false);
|
||||
// localStorage.getItem("showPreview") == 'true'
|
||||
export const showPreview = van.state(true);
|
||||
export const previewUrl = van.state(
|
||||
"https://editor.avatech.ai/viewer?avatarId=default&debug=false&width=400&height=400&hideTrigger=true&voiceSelection=true&hideUI=true"
|
||||
"https://editor.avatech.ai/viewer?avatarId=default&debug=true&width=350&height=350&hideTrigger=true&voiceSelection=true&hideUI=true"
|
||||
);
|
||||
export const previewImg = van.state("");
|
||||
export const previewImgLoading = van.state(false);
|
||||
@@ -63,6 +63,7 @@ export const imagePrompts = van.state([]);
|
||||
|
||||
export const allImagePrompts = van.state([{}]);
|
||||
|
||||
|
||||
/** @type {State<Record<string, Point[]>>} */
|
||||
export const imagePromptsMulti = van.state({});
|
||||
|
||||
@@ -75,7 +76,3 @@ export const targetNode = van.state();
|
||||
export const imageSize = van.state({ width: 0, height: 0, samScale: 0 });
|
||||
export const embeddings = van.state();
|
||||
export const embeddingID = van.state("Test");
|
||||
|
||||
/** @type {State<LGraphNode>} */
|
||||
export const combinePointsNode = van.state();
|
||||
export const samPrompts = van.state({});
|
||||
|
||||
+134
-247
@@ -1,7 +1,7 @@
|
||||
@import url('https://fonts.googleapis.com/css2?family=Gabarito&display=swap');
|
||||
|
||||
/*
|
||||
! tailwindcss v3.3.3 | MIT License | https://tailwindcss.com
|
||||
! tailwindcss v3.4.0 | MIT License | https://tailwindcss.com
|
||||
*/
|
||||
|
||||
/*
|
||||
@@ -34,9 +34,11 @@
|
||||
4. Use the user's configured `sans` font-family by default.
|
||||
5. Use the user's configured `sans` font-feature-settings by default.
|
||||
6. Use the user's configured `sans` font-variation-settings by default.
|
||||
7. Disable tap highlights on iOS
|
||||
*/
|
||||
|
||||
html {
|
||||
html,
|
||||
:host {
|
||||
line-height: 1.5;
|
||||
/* 1 */
|
||||
-webkit-text-size-adjust: 100%;
|
||||
@@ -46,12 +48,14 @@ html {
|
||||
-o-tab-size: 4;
|
||||
tab-size: 4;
|
||||
/* 3 */
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
||||
/* 4 */
|
||||
font-feature-settings: normal;
|
||||
/* 5 */
|
||||
font-variation-settings: normal;
|
||||
/* 6 */
|
||||
-webkit-tap-highlight-color: transparent;
|
||||
/* 7 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -123,8 +127,10 @@ strong {
|
||||
}
|
||||
|
||||
/*
|
||||
1. Use the user's configured `mono` font family by default.
|
||||
2. Correct the odd `em` font sizing in all browsers.
|
||||
1. Use the user's configured `mono` font-family by default.
|
||||
2. Use the user's configured `mono` font-feature-settings by default.
|
||||
3. Use the user's configured `mono` font-variation-settings by default.
|
||||
4. Correct the odd `em` font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
@@ -133,8 +139,12 @@ samp,
|
||||
pre {
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
||||
/* 1 */
|
||||
font-size: 1em;
|
||||
font-feature-settings: normal;
|
||||
/* 2 */
|
||||
font-variation-settings: normal;
|
||||
/* 3 */
|
||||
font-size: 1em;
|
||||
/* 4 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -501,7 +511,7 @@ html{
|
||||
:root{
|
||||
color-scheme: light;
|
||||
--in: 0.7206 0.191 231.6;
|
||||
--su: 0.7441 0.213 164.75;
|
||||
--su: 64.8% 0.150 160;
|
||||
--wa: 0.8471 0.199 83.87;
|
||||
--er: 0.7176 0.221 22.18;
|
||||
--pc: 0.89824 0.06192 275.75;
|
||||
@@ -742,7 +752,7 @@ html{
|
||||
justify-content: center;
|
||||
border-radius: var(--rounded-btn, 0.5rem);
|
||||
border-color: transparent;
|
||||
border-color: oklch(var(--btn-color, var(--b2)) / var(--tw-border-opacity, 1));
|
||||
border-color: oklch(var(--btn-color, var(--b2)) / var(--tw-border-opacity));
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
text-align: center;
|
||||
@@ -762,7 +772,9 @@ html{
|
||||
--tw-shadow-colored: 0 1px 2px 0 var(--tw-shadow-color);
|
||||
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
||||
outline-color: var(--fallback-bc,oklch(var(--bc)/1));
|
||||
background-color: oklch(var(--btn-color, var(--b2)) / var(--tw-bg-opacity, 1));
|
||||
background-color: oklch(var(--btn-color, var(--b2)) / var(--tw-bg-opacity));
|
||||
--tw-bg-opacity: 1;
|
||||
--tw-border-opacity: 1;
|
||||
}
|
||||
|
||||
.btn-disabled,
|
||||
@@ -870,8 +882,7 @@ html{
|
||||
flex-grow: 1;
|
||||
--tw-content: '';
|
||||
content: var(--tw-content);
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: var(--fallback-b3,oklch(var(--b3)/var(--tw-bg-opacity)));
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/0.1));
|
||||
}
|
||||
|
||||
.dropdown{
|
||||
@@ -959,18 +970,23 @@ html{
|
||||
.btn:hover{
|
||||
--tw-border-opacity: 1;
|
||||
border-color: var(--fallback-b3,oklch(var(--b3)/var(--tw-border-opacity)));
|
||||
border-color: color-mix(
|
||||
in oklab,
|
||||
oklch(var(--btn-color, var(--b2)) / var(--tw-border-opacity, 1)) 90%,
|
||||
black
|
||||
);
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: var(--fallback-b3,oklch(var(--b3)/var(--tw-bg-opacity)));
|
||||
background-color: color-mix(
|
||||
in oklab,
|
||||
oklch(var(--btn-color, var(--b2)) / var(--tw-bg-opacity, 1)) 90%,
|
||||
black
|
||||
);
|
||||
}
|
||||
|
||||
@supports (color: color-mix(in oklab, black, black)){
|
||||
.btn:hover{
|
||||
background-color: color-mix(
|
||||
in oklab,
|
||||
oklch(var(--btn-color, var(--b2)) / var(--tw-bg-opacity, 1)) 90%,
|
||||
black
|
||||
);
|
||||
border-color: color-mix(
|
||||
in oklab,
|
||||
oklch(var(--btn-color, var(--b2)) / var(--tw-border-opacity, 1)) 90%,
|
||||
black
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@supports not (color: oklch(0 0 0)){
|
||||
@@ -995,64 +1011,6 @@ html{
|
||||
}
|
||||
}
|
||||
|
||||
.btn-outline:hover{
|
||||
--tw-border-opacity: 1;
|
||||
border-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-border-opacity)));
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity)));
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-b1,oklch(var(--b1)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-primary:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-secondary:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-sc,oklch(var(--sc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-s,oklch(var(--s)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-s,oklch(var(--s)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-accent:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-ac,oklch(var(--ac)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-a,oklch(var(--a)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-a,oklch(var(--a)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-success:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-suc,oklch(var(--suc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-su,oklch(var(--su)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-su,oklch(var(--su)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-info:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-inc,oklch(var(--inc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-in,oklch(var(--in)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-in,oklch(var(--in)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-warning:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-wac,oklch(var(--wac)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-wa,oklch(var(--wa)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-wa,oklch(var(--wa)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-error:hover{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-erc,oklch(var(--erc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-er,oklch(var(--er)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-er,oklch(var(--er)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-disabled:hover,
|
||||
.btn[disabled]:hover,
|
||||
.btn:disabled:hover{
|
||||
@@ -1063,9 +1021,11 @@ html{
|
||||
--tw-text-opacity: 0.2;
|
||||
}
|
||||
|
||||
.btn:is(input[type="checkbox"]:checked):hover, .btn:is(input[type="radio"]:checked):hover{
|
||||
background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
@supports (color: color-mix(in oklab, black, black)){
|
||||
.btn:is(input[type="checkbox"]:checked):hover, .btn:is(input[type="radio"]:checked):hover{
|
||||
background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
}
|
||||
}
|
||||
|
||||
.dropdown.dropdown-hover:hover .dropdown-content{
|
||||
@@ -1076,8 +1036,6 @@ html{
|
||||
|
||||
:where(.menu li:not(.menu-title):not(.disabled) > *:not(ul):not(details):not(.menu-title)):not(.active):hover, :where(.menu li:not(.menu-title):not(.disabled) > details > summary:not(.menu-title)):not(.active):hover{
|
||||
cursor: pointer;
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity)));
|
||||
outline: 2px solid transparent;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
@@ -1108,6 +1066,9 @@ html{
|
||||
|
||||
.input{
|
||||
flex-shrink: 1;
|
||||
-webkit-appearance: none;
|
||||
-moz-appearance: none;
|
||||
appearance: none;
|
||||
height: 3rem;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
@@ -1210,10 +1171,8 @@ html{
|
||||
.menu :where(li ul){
|
||||
position: relative;
|
||||
white-space: nowrap;
|
||||
-webkit-margin-start: 1rem;
|
||||
margin-inline-start: 1rem;
|
||||
-webkit-padding-start: 0.5rem;
|
||||
padding-inline-start: 0.5rem;
|
||||
margin-inline-start: 1rem;
|
||||
padding-inline-start: 0.5rem;
|
||||
}
|
||||
|
||||
.menu :where(li:not(.menu-title) > *:not(ul):not(details):not(.menu-title)),
|
||||
@@ -1440,109 +1399,6 @@ html{
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/0.2));
|
||||
}
|
||||
|
||||
.btn-outline{
|
||||
border-color: currentColor;
|
||||
background-color: transparent;
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity)));
|
||||
--tw-shadow: 0 0 #0000;
|
||||
--tw-shadow-colored: 0 0 #0000;
|
||||
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
||||
}
|
||||
|
||||
.btn-outline.btn-active{
|
||||
--tw-border-opacity: 1;
|
||||
border-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-border-opacity)));
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity)));
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-b1,oklch(var(--b1)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-primary{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-p,oklch(var(--p)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-primary.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-pc,oklch(var(--pc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-p,oklch(var(--p)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-secondary{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-s,oklch(var(--s)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-secondary.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-sc,oklch(var(--sc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-s,oklch(var(--s)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-s,oklch(var(--s)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-accent{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-a,oklch(var(--a)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-accent.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-ac,oklch(var(--ac)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-a,oklch(var(--a)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-a,oklch(var(--a)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-success{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-su,oklch(var(--su)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-success.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-suc,oklch(var(--suc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-su,oklch(var(--su)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-su,oklch(var(--su)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-info{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-in,oklch(var(--in)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-info.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-inc,oklch(var(--inc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-in,oklch(var(--in)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-in,oklch(var(--in)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-warning{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-wa,oklch(var(--wa)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-warning.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-wac,oklch(var(--wac)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-wa,oklch(var(--wa)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-wa,oklch(var(--wa)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn-outline.btn-error{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-er,oklch(var(--er)/var(--tw-text-opacity)));
|
||||
}
|
||||
|
||||
.btn-outline.btn-error.btn-active{
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-erc,oklch(var(--erc)/var(--tw-text-opacity)));
|
||||
background-color: color-mix(in oklab, var(--fallback-er,oklch(var(--er)/1)) 90%, black);
|
||||
border-color: color-mix(in oklab, var(--fallback-er,oklch(var(--er)/1)) 90%, black);
|
||||
}
|
||||
|
||||
.btn.btn-disabled,
|
||||
.btn[disabled],
|
||||
.btn:disabled{
|
||||
@@ -1646,8 +1502,7 @@ details.collapse summary::-webkit-details-marker{
|
||||
:where(.collapse > input[type="radio"]){
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
-webkit-padding-end: 3rem;
|
||||
padding-inline-end: 3rem;
|
||||
padding-inline-end: 3rem;
|
||||
min-height: 3.75rem;
|
||||
transition: background-color 0.2s ease-out;
|
||||
}
|
||||
@@ -1715,18 +1570,6 @@ details.collapse summary::-webkit-details-marker{
|
||||
outline-color: var(--fallback-bc,oklch(var(--bc)/0.2));
|
||||
}
|
||||
|
||||
.input-ghost{
|
||||
--tw-bg-opacity: 0.05;
|
||||
}
|
||||
|
||||
.input-ghost:focus,
|
||||
.input-ghost:focus-within{
|
||||
--tw-bg-opacity: 1;
|
||||
--tw-text-opacity: 1;
|
||||
color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity)));
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
.input-disabled,
|
||||
.input:disabled,
|
||||
.input[disabled]{
|
||||
@@ -1750,11 +1593,14 @@ details.collapse summary::-webkit-details-marker{
|
||||
--tw-placeholder-opacity: 0.2;
|
||||
}
|
||||
|
||||
.input::-webkit-date-and-time-value{
|
||||
text-align: inherit;
|
||||
}
|
||||
|
||||
.join > :where(*:not(:first-child)){
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
-webkit-margin-start: -1px;
|
||||
margin-inline-start: -1px;
|
||||
margin-inline-start: -1px;
|
||||
}
|
||||
|
||||
.link:focus{
|
||||
@@ -1797,7 +1643,9 @@ details.collapse summary::-webkit-details-marker{
|
||||
}
|
||||
|
||||
:where(.menu li:empty){
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/0.1));
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity)));
|
||||
opacity: 0.1;
|
||||
margin: 0.5rem 1rem;
|
||||
height: 1px;
|
||||
}
|
||||
@@ -1808,7 +1656,9 @@ details.collapse summary::-webkit-details-marker{
|
||||
inset-inline-start: 0px;
|
||||
top: 0.75rem;
|
||||
width: 1px;
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/0.1));
|
||||
--tw-bg-opacity: 1;
|
||||
background-color: var(--fallback-bc,oklch(var(--bc)/var(--tw-bg-opacity)));
|
||||
opacity: 0.1;
|
||||
content: "";
|
||||
}
|
||||
|
||||
@@ -1933,7 +1783,7 @@ details.collapse summary::-webkit-details-marker{
|
||||
|
||||
.modal:not(dialog:not(.modal-open)),
|
||||
.modal::backdrop{
|
||||
background-color: rgba(0, 0, 0, 0.3);
|
||||
background-color: #0006;
|
||||
animation: modal-pop 0.2s ease-out;
|
||||
}
|
||||
|
||||
@@ -2256,8 +2106,7 @@ details.collapse summary::-webkit-details-marker{
|
||||
.join.join-horizontal > :where(*:not(:first-child)){
|
||||
margin-top: 0px;
|
||||
margin-bottom: 0px;
|
||||
-webkit-margin-start: -1px;
|
||||
margin-inline-start: -1px;
|
||||
margin-inline-start: -1px;
|
||||
}
|
||||
|
||||
.modal-top :where(.modal-box){
|
||||
@@ -2469,19 +2318,43 @@ details.collapse summary::-webkit-details-marker{
|
||||
height: 394px;
|
||||
}
|
||||
|
||||
.h-full{
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.h-fit{
|
||||
height: -moz-fit-content;
|
||||
height: fit-content;
|
||||
}
|
||||
|
||||
.h-full{
|
||||
height: 100%;
|
||||
.h-\[400px\]{
|
||||
height: 400px;
|
||||
}
|
||||
|
||||
.h-\[420px\]{
|
||||
height: 420px;
|
||||
}
|
||||
|
||||
.h-\[410px\]{
|
||||
height: 410px;
|
||||
}
|
||||
|
||||
.h-\[360px\]{
|
||||
height: 360px;
|
||||
}
|
||||
|
||||
.min-h-\[400px\]{
|
||||
min-height: 400px;
|
||||
}
|
||||
|
||||
.min-h-\[380px\]{
|
||||
min-height: 380px;
|
||||
}
|
||||
|
||||
.min-h-\[350px\]{
|
||||
min-height: 350px;
|
||||
}
|
||||
|
||||
.w-20{
|
||||
width: 5rem;
|
||||
}
|
||||
@@ -2515,10 +2388,42 @@ details.collapse summary::-webkit-details-marker{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.w-\[\]{
|
||||
width: ;
|
||||
}
|
||||
|
||||
.w-\[400px\]{
|
||||
width: 400px;
|
||||
}
|
||||
|
||||
.w-\[420px\]{
|
||||
width: 420px;
|
||||
}
|
||||
|
||||
.w-\[410px\]{
|
||||
width: 410px;
|
||||
}
|
||||
|
||||
.w-\[360px\]{
|
||||
width: 360px;
|
||||
}
|
||||
|
||||
.min-w-\[400px\]{
|
||||
min-width: 400px;
|
||||
}
|
||||
|
||||
.min-w-\[380\]{
|
||||
min-width: 380;
|
||||
}
|
||||
|
||||
.min-w-\[380px\]{
|
||||
min-width: 380px;
|
||||
}
|
||||
|
||||
.min-w-\[350px\]{
|
||||
min-width: 350px;
|
||||
}
|
||||
|
||||
.max-w-\[100\%\]{
|
||||
max-width: 100%;
|
||||
}
|
||||
@@ -2569,10 +2474,6 @@ details.collapse summary::-webkit-details-marker{
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.justify-around{
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.gap-2{
|
||||
gap: 0.5rem;
|
||||
}
|
||||
@@ -2589,14 +2490,6 @@ details.collapse summary::-webkit-details-marker{
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.overflow-y-auto{
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.overflow-x-hidden{
|
||||
overflow-x: hidden;
|
||||
}
|
||||
|
||||
.rounded{
|
||||
border-radius: 0.25rem;
|
||||
}
|
||||
@@ -2621,6 +2514,14 @@ details.collapse summary::-webkit-details-marker{
|
||||
border-radius: 0.125rem;
|
||||
}
|
||||
|
||||
.rounded-2xl{
|
||||
border-radius: 1rem;
|
||||
}
|
||||
|
||||
.rounded-xl{
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
|
||||
.rounded-b-md{
|
||||
border-bottom-right-radius: 0.375rem;
|
||||
border-bottom-left-radius: 0.375rem;
|
||||
@@ -2834,14 +2735,14 @@ details.collapse summary::-webkit-details-marker{
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.p-24{
|
||||
padding: 6rem;
|
||||
}
|
||||
|
||||
.p-4{
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.p-24{
|
||||
padding: 6rem;
|
||||
}
|
||||
|
||||
.\!px-0{
|
||||
padding-left: 0px !important;
|
||||
padding-right: 0px !important;
|
||||
@@ -2857,18 +2758,14 @@ details.collapse summary::-webkit-details-marker{
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
.py-16{
|
||||
padding-top: 4rem;
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
.py-2{
|
||||
padding-top: 0.5rem;
|
||||
padding-bottom: 0.5rem;
|
||||
}
|
||||
|
||||
.pr-2{
|
||||
padding-right: 0.5rem;
|
||||
.py-16{
|
||||
padding-top: 4rem;
|
||||
padding-bottom: 4rem;
|
||||
}
|
||||
|
||||
.text-start{
|
||||
@@ -3195,21 +3092,11 @@ img[src] {
|
||||
color: rgb(239 68 68 / var(--tw-text-opacity));
|
||||
}
|
||||
|
||||
.focus\:border-none:focus{
|
||||
border-style: none;
|
||||
}
|
||||
|
||||
.focus\:outline-none:focus{
|
||||
outline: 2px solid transparent;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.focus\:ring-0:focus{
|
||||
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
||||
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
||||
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
||||
}
|
||||
|
||||
@media (min-width: 640px){
|
||||
.sm\:flex{
|
||||
display: flex;
|
||||
|
||||
@@ -126,7 +126,7 @@ async def post_sam_model(request):
|
||||
}
|
||||
json.dump(data, f)
|
||||
else:
|
||||
sam = sam_model_registry[model_type](checkpoint=ckpt).to("cuda")
|
||||
sam = sam_model_registry[model_type](checkpoint=ckpt)
|
||||
predictor = SamPredictor(sam)
|
||||
|
||||
image_np = (image * 255).astype(np.uint8)
|
||||
@@ -222,8 +222,6 @@ def load_workflow(workflow_name):
|
||||
return "\n".join(f.readlines())
|
||||
|
||||
|
||||
default_workflow = load_workflow("avatar_generation_mask_api_v11(FaceToon)")
|
||||
|
||||
|
||||
@server.PromptServer.instance.routes.post("/avatar_generation")
|
||||
async def post_prompt_block(request):
|
||||
@@ -235,8 +233,6 @@ async def post_prompt_block(request):
|
||||
workflow = uploaded_workflow
|
||||
elif workflow_name is not None:
|
||||
workflow = load_workflow(workflow_name)
|
||||
else:
|
||||
workflow = default_workflow
|
||||
|
||||
ref_image = post.get("ref_image")
|
||||
base_image = post.get("base_image")
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
|
||||
class CombinePoints:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("SAM_PROMPTS",)
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
CATEGORY = "image"
|
||||
|
||||
# OUTPUT_NODE = True
|
||||
|
||||
def run(self, *args, **kwargs):
|
||||
print("args", args)
|
||||
print("kwargs", kwargs)
|
||||
return ([])
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {"Combine Points": CombinePoints}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {"Combine Points": "Combine Points"}
|
||||
@@ -1,66 +0,0 @@
|
||||
import cv2
|
||||
import numpy as np
|
||||
import torch
|
||||
|
||||
|
||||
class ExtractBoundaryPoints:
|
||||
@classmethod
|
||||
def INPUT_TYPES(s):
|
||||
return {
|
||||
"required": {
|
||||
"image": ("IMAGE",),
|
||||
"n_points": ("INT", {"default": -1, "min": -1, "max": 100}),
|
||||
},
|
||||
}
|
||||
|
||||
RETURN_TYPES = ("POINTS", "IMAGE")
|
||||
|
||||
FUNCTION = "run"
|
||||
|
||||
CATEGORY = "image"
|
||||
|
||||
def find_main_contour(self, image, n_points):
|
||||
image = np.copy(image[0].numpy())
|
||||
gray = cv2.cvtColor(image, cv2.COLOR_RGB2GRAY)
|
||||
gray = (gray * 255).astype(np.uint8)
|
||||
# Find contours
|
||||
contours, _ = cv2.findContours(gray, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
|
||||
|
||||
if len(contours) == 0:
|
||||
raise Exception(
|
||||
"No contours found. Please ensure that the image has the correct segments (e.g. when you click on the mouth, it should display a proper blue area over the mouth region)."
|
||||
)
|
||||
|
||||
# Get the largest contour
|
||||
areas = [cv2.contourArea(contour) for contour in contours]
|
||||
|
||||
max_area_index = areas.index(max(areas))
|
||||
largest_contour = contours[max_area_index]
|
||||
if n_points > 0:
|
||||
divided_by = int(largest_contour.shape[0] / n_points)
|
||||
divided_by = min(divided_by, largest_contour.shape[0])
|
||||
largest_contour = largest_contour[::divided_by].astype(int)
|
||||
contours = [largest_contour]
|
||||
|
||||
if not image.flags["C_CONTIGUOUS"]:
|
||||
image = np.ascontiguousarray(image)
|
||||
cv2.drawContours(image, contours, -1, (0, 255, 0), 3)
|
||||
|
||||
points = []
|
||||
for point in largest_contour:
|
||||
points.append(
|
||||
{"x": point[0][0], "y": point[0][1], "label": 1, "isAuto": True}
|
||||
)
|
||||
|
||||
return image, points
|
||||
|
||||
def run(self, image, n_points):
|
||||
contour_image, points = self.find_main_contour(image, n_points)
|
||||
contour_image = torch.from_numpy(np.expand_dims(contour_image, axis=0))
|
||||
print(points)
|
||||
return (points, contour_image)
|
||||
|
||||
|
||||
NODE_CLASS_MAPPINGS = {"Extract Boundary Points": ExtractBoundaryPoints}
|
||||
|
||||
NODE_DISPLAY_NAME_MAPPINGS = {"Extract Boundary Points": "Extract Boundary Points"}
|
||||
Reference in New Issue
Block a user