Update artworks.yaml
Browse files- artworks.yaml +152 -152
artworks.yaml
CHANGED
|
@@ -13,6 +13,7 @@ nodes:
|
|
| 13 |
category:
|
| 14 |
_id: generate_images
|
| 15 |
title: en=Generate images;ru=Генерация изображений
|
|
|
|
| 16 |
environment:
|
| 17 |
OPEN_PAAS_USER:
|
| 18 |
title: PaaS user
|
|
@@ -26,6 +27,7 @@ nodes:
|
|
| 26 |
title: PaaS base url
|
| 27 |
type: string
|
| 28 |
scope: global
|
|
|
|
| 29 |
groups:
|
| 30 |
inputs:
|
| 31 |
SDXL:
|
|
@@ -323,8 +325,6 @@ nodes:
|
|
| 323 |
source: catalog
|
| 324 |
title: en=Image to image;ru=Пересоздать изображение
|
| 325 |
version: 1
|
| 326 |
-
description: ""
|
| 327 |
-
execution: regular
|
| 328 |
generate_image_artworks:
|
| 329 |
_id: generate_image_artworks
|
| 330 |
arrange:
|
|
@@ -346,6 +346,7 @@ nodes:
|
|
| 346 |
title: PaaS base url
|
| 347 |
type: string
|
| 348 |
scope: global
|
|
|
|
| 349 |
groups:
|
| 350 |
inputs:
|
| 351 |
SDXL:
|
|
@@ -669,7 +670,6 @@ nodes:
|
|
| 669 |
source: catalog
|
| 670 |
title: en=Generate image;ru=Генерация изображения
|
| 671 |
version: 2
|
| 672 |
-
execution: regular
|
| 673 |
inpaint_image_artworks:
|
| 674 |
_id: inpaint_image_artworks
|
| 675 |
arrange:
|
|
@@ -691,6 +691,7 @@ nodes:
|
|
| 691 |
title: PaaS base url
|
| 692 |
type: string
|
| 693 |
scope: global
|
|
|
|
| 694 |
groups:
|
| 695 |
inputs:
|
| 696 |
mask:
|
|
@@ -1024,7 +1025,6 @@ nodes:
|
|
| 1024 |
source: catalog
|
| 1025 |
title: en=Inpaint on image;ru=Улучшить изображение
|
| 1026 |
version: 1
|
| 1027 |
-
execution: regular
|
| 1028 |
exctract_mask_on_image_artworks:
|
| 1029 |
_id: exctract_mask_on_image_artworks
|
| 1030 |
arrange:
|
|
@@ -1032,7 +1032,6 @@ nodes:
|
|
| 1032 |
y: 50
|
| 1033 |
category:
|
| 1034 |
_id: image_analysis
|
| 1035 |
-
id: image_analysis
|
| 1036 |
title: en=Image analysis;ru=Анализ изображений
|
| 1037 |
environment:
|
| 1038 |
OPEN_PAAS_USER:
|
|
@@ -1047,6 +1046,7 @@ nodes:
|
|
| 1047 |
title: PaaS base url
|
| 1048 |
type: string
|
| 1049 |
scope: global
|
|
|
|
| 1050 |
inputs:
|
| 1051 |
image:
|
| 1052 |
order: 1
|
|
@@ -1282,14 +1282,14 @@ nodes:
|
|
| 1282 |
source: catalog
|
| 1283 |
title: en=Extract mask on image;ru=Выделить маску
|
| 1284 |
version: 1
|
| 1285 |
-
|
| 1286 |
-
_id:
|
| 1287 |
arrange:
|
| 1288 |
-
x:
|
| 1289 |
-
y:
|
| 1290 |
category:
|
| 1291 |
-
_id:
|
| 1292 |
-
title: en=
|
| 1293 |
environment:
|
| 1294 |
OPEN_PAAS_USER:
|
| 1295 |
title: PaaS user
|
|
@@ -1303,29 +1303,95 @@ nodes:
|
|
| 1303 |
title: PaaS base url
|
| 1304 |
type: string
|
| 1305 |
scope: global
|
|
|
|
| 1306 |
inputs:
|
| 1307 |
image:
|
| 1308 |
order: 1
|
| 1309 |
title: en=Image;ru=Изображение
|
| 1310 |
type: image
|
| 1311 |
required: true
|
| 1312 |
-
|
| 1313 |
order: 2
|
| 1314 |
-
title: en=
|
| 1315 |
-
type:
|
| 1316 |
required: true
|
| 1317 |
-
|
| 1318 |
-
max: 4
|
| 1319 |
-
step: 0.1
|
| 1320 |
-
default: 2
|
| 1321 |
outputs:
|
| 1322 |
-
|
| 1323 |
-
title: en=
|
| 1324 |
type: image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1325 |
package: artworks
|
| 1326 |
-
script:
|
| 1327 |
const CHECK_TASK_INTERVAL = 3000;
|
| 1328 |
-
const MAX_ATTEMPTS =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1329 |
|
| 1330 |
export async function run({ inputs, state }) {
|
| 1331 |
|
|
@@ -1352,18 +1418,15 @@ nodes:
|
|
| 1352 |
});
|
| 1353 |
|
| 1354 |
if (!state) {
|
| 1355 |
-
const {
|
| 1356 |
-
image,
|
| 1357 |
-
upscalingResize,
|
| 1358 |
-
} = inputs;
|
| 1359 |
|
| 1360 |
const payload = {
|
| 1361 |
-
type: "
|
| 1362 |
isFast: true,
|
| 1363 |
payload: {
|
| 1364 |
base64: false,
|
| 1365 |
image,
|
| 1366 |
-
|
| 1367 |
},
|
| 1368 |
};
|
| 1369 |
try {
|
|
@@ -1380,7 +1443,7 @@ nodes:
|
|
| 1380 |
total: MAX_ATTEMPTS,
|
| 1381 |
processed: 0
|
| 1382 |
},
|
| 1383 |
-
delay:
|
| 1384 |
});
|
| 1385 |
} catch (e) {
|
| 1386 |
if (e instanceof ArtWorksError) {
|
|
@@ -1425,11 +1488,30 @@ nodes:
|
|
| 1425 |
},
|
| 1426 |
});
|
| 1427 |
}
|
| 1428 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1429 |
return NextNode.from({
|
| 1430 |
outputs: {
|
| 1431 |
-
|
| 1432 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1433 |
});
|
| 1434 |
} catch (e) {
|
| 1435 |
if (e instanceof ArtWorksError) {
|
|
@@ -1440,17 +1522,16 @@ nodes:
|
|
| 1440 |
}
|
| 1441 |
}
|
| 1442 |
source: catalog
|
| 1443 |
-
title: en=
|
| 1444 |
version: 1
|
| 1445 |
-
|
| 1446 |
-
|
| 1447 |
-
_id: detect_face_on_image_artworks
|
| 1448 |
arrange:
|
| 1449 |
-
x:
|
| 1450 |
-
y:
|
| 1451 |
category:
|
| 1452 |
-
_id:
|
| 1453 |
-
title: en=
|
| 1454 |
environment:
|
| 1455 |
OPEN_PAAS_USER:
|
| 1456 |
title: PaaS user
|
|
@@ -1464,94 +1545,30 @@ nodes:
|
|
| 1464 |
title: PaaS base url
|
| 1465 |
type: string
|
| 1466 |
scope: global
|
|
|
|
| 1467 |
inputs:
|
| 1468 |
image:
|
| 1469 |
order: 1
|
| 1470 |
title: en=Image;ru=Изображение
|
| 1471 |
type: image
|
| 1472 |
required: true
|
| 1473 |
-
|
| 1474 |
order: 2
|
| 1475 |
-
title: en=
|
| 1476 |
-
type:
|
| 1477 |
required: true
|
| 1478 |
-
|
|
|
|
|
|
|
|
|
|
| 1479 |
outputs:
|
| 1480 |
-
|
| 1481 |
-
title: en=
|
| 1482 |
type: image
|
| 1483 |
-
features:
|
| 1484 |
-
title: en=Features;ru=Характеристики
|
| 1485 |
-
type: json
|
| 1486 |
-
schema: face-features
|
| 1487 |
package: artworks
|
| 1488 |
-
script:
|
| 1489 |
const CHECK_TASK_INTERVAL = 3000;
|
| 1490 |
-
const MAX_ATTEMPTS =
|
| 1491 |
-
|
| 1492 |
-
const FIT_FACE_SIZE = 512;
|
| 1493 |
-
|
| 1494 |
-
export async function fit(image, { maxWidth, maxHeight }) {
|
| 1495 |
-
const { width, height } = await image.metadata();
|
| 1496 |
-
const orientation = width >= height ? "-" : "|";
|
| 1497 |
-
|
| 1498 |
-
const sharp = require('sharp/lib/index.js');
|
| 1499 |
-
|
| 1500 |
-
switch (orientation) {
|
| 1501 |
-
case "-":
|
| 1502 |
-
if (width > maxWidth) {
|
| 1503 |
-
return sharp(await image.resize({ width: maxWidth }).toBuffer());
|
| 1504 |
-
}
|
| 1505 |
-
break;
|
| 1506 |
-
case "|":
|
| 1507 |
-
if (height > maxHeight) {
|
| 1508 |
-
return sharp(await image.resize({ height: maxHeight }).toBuffer());
|
| 1509 |
-
}
|
| 1510 |
-
break;
|
| 1511 |
-
}
|
| 1512 |
-
|
| 1513 |
-
return image;
|
| 1514 |
-
}
|
| 1515 |
-
|
| 1516 |
-
export async function crop(source, face) {
|
| 1517 |
-
const sharp = require('sharp/lib/index.js');
|
| 1518 |
-
|
| 1519 |
-
const image = await sharp(source);
|
| 1520 |
-
const metadata = await image.metadata();
|
| 1521 |
-
|
| 1522 |
-
const UNCROP = 0.6;
|
| 1523 |
-
|
| 1524 |
-
let { x, y, width, height } = face;
|
| 1525 |
-
|
| 1526 |
-
const uncropX = width * UNCROP;
|
| 1527 |
-
const uncropY = height * UNCROP;
|
| 1528 |
-
|
| 1529 |
-
width = Math.round(width + uncropX);
|
| 1530 |
-
height = Math.round(height + uncropY);
|
| 1531 |
-
x = Math.round(x - uncropX / 2);
|
| 1532 |
-
y = Math.round(y - uncropY / 2);
|
| 1533 |
-
|
| 1534 |
-
const [left, top] = [Math.max(x, 0), Math.max(y, 0)];
|
| 1535 |
-
[width, height] = [
|
| 1536 |
-
Math.min(width, metadata.width - left),
|
| 1537 |
-
Math.min(height, metadata.height - top),
|
| 1538 |
-
];
|
| 1539 |
-
const size = Math.min(width, height);
|
| 1540 |
-
|
| 1541 |
-
const crop = {
|
| 1542 |
-
left,
|
| 1543 |
-
top,
|
| 1544 |
-
width: size,
|
| 1545 |
-
height: size,
|
| 1546 |
-
};
|
| 1547 |
-
|
| 1548 |
-
const area = await fit(await image.clone().extract(crop).webp(), {
|
| 1549 |
-
maxWidth: FIT_FACE_SIZE,
|
| 1550 |
-
maxHeight: FIT_FACE_SIZE,
|
| 1551 |
-
});
|
| 1552 |
-
|
| 1553 |
-
return area.toBuffer();
|
| 1554 |
-
}
|
| 1555 |
|
| 1556 |
export async function run({ inputs, state }) {
|
| 1557 |
|
|
@@ -1578,15 +1595,18 @@ nodes:
|
|
| 1578 |
});
|
| 1579 |
|
| 1580 |
if (!state) {
|
| 1581 |
-
const {
|
|
|
|
|
|
|
|
|
|
| 1582 |
|
| 1583 |
const payload = {
|
| 1584 |
-
type: "
|
| 1585 |
isFast: true,
|
| 1586 |
payload: {
|
| 1587 |
base64: false,
|
| 1588 |
image,
|
| 1589 |
-
|
| 1590 |
},
|
| 1591 |
};
|
| 1592 |
try {
|
|
@@ -1603,7 +1623,7 @@ nodes:
|
|
| 1603 |
total: MAX_ATTEMPTS,
|
| 1604 |
processed: 0
|
| 1605 |
},
|
| 1606 |
-
delay:
|
| 1607 |
});
|
| 1608 |
} catch (e) {
|
| 1609 |
if (e instanceof ArtWorksError) {
|
|
@@ -1648,30 +1668,11 @@ nodes:
|
|
| 1648 |
},
|
| 1649 |
});
|
| 1650 |
}
|
| 1651 |
-
|
| 1652 |
-
const { image, index } = inputs;
|
| 1653 |
-
const face = faces[index];
|
| 1654 |
-
if (!face) {
|
| 1655 |
-
throw new FatalError("Face with such index was not found");
|
| 1656 |
-
}
|
| 1657 |
-
const { x, y, width, height, ageFrom, ageTo, gender, race, emotion } = face;
|
| 1658 |
-
const { data } = await download(image);
|
| 1659 |
return NextNode.from({
|
| 1660 |
outputs: {
|
| 1661 |
-
|
| 1662 |
-
|
| 1663 |
-
y,
|
| 1664 |
-
width,
|
| 1665 |
-
height,
|
| 1666 |
-
}),
|
| 1667 |
-
features: {
|
| 1668 |
-
ageFrom,
|
| 1669 |
-
ageTo,
|
| 1670 |
-
gender,
|
| 1671 |
-
race,
|
| 1672 |
-
emotion,
|
| 1673 |
-
},
|
| 1674 |
-
},
|
| 1675 |
});
|
| 1676 |
} catch (e) {
|
| 1677 |
if (e instanceof ArtWorksError) {
|
|
@@ -1682,9 +1683,8 @@ nodes:
|
|
| 1682 |
}
|
| 1683 |
}
|
| 1684 |
source: catalog
|
| 1685 |
-
title: en=
|
| 1686 |
version: 1
|
| 1687 |
-
execution: regular
|
| 1688 |
classify_image_artworks:
|
| 1689 |
_id: classify_image_artworks
|
| 1690 |
arrange:
|
|
@@ -1706,6 +1706,7 @@ nodes:
|
|
| 1706 |
title: PaaS base url
|
| 1707 |
type: string
|
| 1708 |
scope: global
|
|
|
|
| 1709 |
inputs:
|
| 1710 |
image:
|
| 1711 |
order: 1
|
|
@@ -1846,7 +1847,6 @@ nodes:
|
|
| 1846 |
source: catalog
|
| 1847 |
title: en=Classify image;ru=Тегировать изображение
|
| 1848 |
version: 1
|
| 1849 |
-
execution: regular
|
| 1850 |
translate_text_artworks:
|
| 1851 |
_id: translate_text_artworks
|
| 1852 |
arrange:
|
|
@@ -1868,6 +1868,7 @@ nodes:
|
|
| 1868 |
title: PaaS base url
|
| 1869 |
type: string
|
| 1870 |
scope: global
|
|
|
|
| 1871 |
inputs:
|
| 1872 |
source:
|
| 1873 |
order: 1
|
|
@@ -2046,7 +2047,6 @@ nodes:
|
|
| 2046 |
source: catalog
|
| 2047 |
title: en=Translate text;ru=Перевести текст
|
| 2048 |
version: 1
|
| 2049 |
-
execution: regular
|
| 2050 |
face_swap_on_image_artworks:
|
| 2051 |
_id: face_swap_on_image_artworks
|
| 2052 |
arrange:
|
|
@@ -2068,6 +2068,7 @@ nodes:
|
|
| 2068 |
title: PaaS base url
|
| 2069 |
type: string
|
| 2070 |
scope: global
|
|
|
|
| 2071 |
inputs:
|
| 2072 |
face:
|
| 2073 |
order: 1
|
|
@@ -2208,7 +2209,6 @@ nodes:
|
|
| 2208 |
source: catalog
|
| 2209 |
title: en=Face swap on image;ru=Замена лица на изображении
|
| 2210 |
version: 1
|
| 2211 |
-
execution: regular
|
| 2212 |
remove_background_artworks:
|
| 2213 |
_id: remove_background_artworks
|
| 2214 |
arrange:
|
|
@@ -2230,6 +2230,7 @@ nodes:
|
|
| 2230 |
title: PaaS base url
|
| 2231 |
type: string
|
| 2232 |
scope: global
|
|
|
|
| 2233 |
inputs:
|
| 2234 |
image:
|
| 2235 |
order: 1
|
|
@@ -2369,7 +2370,6 @@ nodes:
|
|
| 2369 |
source: catalog
|
| 2370 |
title: en=Remove background;ru=Удалить фон
|
| 2371 |
version: 1
|
| 2372 |
-
execution: regular
|
| 2373 |
outpaint_image_artworks:
|
| 2374 |
_id: outpaint_image_artworks
|
| 2375 |
arrange:
|
|
@@ -2391,6 +2391,7 @@ nodes:
|
|
| 2391 |
title: PaaS base url
|
| 2392 |
type: string
|
| 2393 |
scope: global
|
|
|
|
| 2394 |
groups:
|
| 2395 |
inputs:
|
| 2396 |
base:
|
|
@@ -2695,7 +2696,6 @@ nodes:
|
|
| 2695 |
source: catalog
|
| 2696 |
title: en=Outpaint on image;ru=Расширить изображение
|
| 2697 |
version: 1
|
| 2698 |
-
execution: regular
|
| 2699 |
ask_llm_artworks:
|
| 2700 |
_id: ask_llm_artworks
|
| 2701 |
arrange:
|
|
@@ -2717,6 +2717,7 @@ nodes:
|
|
| 2717 |
title: PaaS base url
|
| 2718 |
type: string
|
| 2719 |
scope: global
|
|
|
|
| 2720 |
inputs:
|
| 2721 |
model:
|
| 2722 |
order: 1
|
|
@@ -2878,7 +2879,6 @@ nodes:
|
|
| 2878 |
source: catalog
|
| 2879 |
title: en=Ask LLM agent;ru=Спросить LLM
|
| 2880 |
version: 1
|
| 2881 |
-
execution: regular
|
| 2882 |
ask_vlm_artworks:
|
| 2883 |
_id: ask_vlm_artworks
|
| 2884 |
arrange:
|
|
@@ -3057,6 +3057,7 @@ nodes:
|
|
| 3057 |
title: PaaS base url
|
| 3058 |
type: string
|
| 3059 |
scope: global
|
|
|
|
| 3060 |
inputs:
|
| 3061 |
image:
|
| 3062 |
order: 1
|
|
@@ -3182,7 +3183,6 @@ nodes:
|
|
| 3182 |
source: catalog
|
| 3183 |
title: en=Detect NSFW;ru=Определить NSFW
|
| 3184 |
version: 1
|
| 3185 |
-
execution: regular
|
| 3186 |
srore_aesthetics:
|
| 3187 |
_id: srore_aesthetics
|
| 3188 |
arrange:
|
|
@@ -3204,6 +3204,7 @@ nodes:
|
|
| 3204 |
title: PaaS base url
|
| 3205 |
type: string
|
| 3206 |
scope: global
|
|
|
|
| 3207 |
inputs:
|
| 3208 |
image:
|
| 3209 |
order: 1
|
|
@@ -3329,4 +3330,3 @@ nodes:
|
|
| 3329 |
source: catalog
|
| 3330 |
title: en=Score aesthetics;ru=Оценить эстестику
|
| 3331 |
version: 1
|
| 3332 |
-
execution: regular
|
|
|
|
| 13 |
category:
|
| 14 |
_id: generate_images
|
| 15 |
title: en=Generate images;ru=Генерация изображений
|
| 16 |
+
description: ""
|
| 17 |
environment:
|
| 18 |
OPEN_PAAS_USER:
|
| 19 |
title: PaaS user
|
|
|
|
| 27 |
title: PaaS base url
|
| 28 |
type: string
|
| 29 |
scope: global
|
| 30 |
+
execution: regular
|
| 31 |
groups:
|
| 32 |
inputs:
|
| 33 |
SDXL:
|
|
|
|
| 325 |
source: catalog
|
| 326 |
title: en=Image to image;ru=Пересоздать изображение
|
| 327 |
version: 1
|
|
|
|
|
|
|
| 328 |
generate_image_artworks:
|
| 329 |
_id: generate_image_artworks
|
| 330 |
arrange:
|
|
|
|
| 346 |
title: PaaS base url
|
| 347 |
type: string
|
| 348 |
scope: global
|
| 349 |
+
execution: regular
|
| 350 |
groups:
|
| 351 |
inputs:
|
| 352 |
SDXL:
|
|
|
|
| 670 |
source: catalog
|
| 671 |
title: en=Generate image;ru=Генерация изображения
|
| 672 |
version: 2
|
|
|
|
| 673 |
inpaint_image_artworks:
|
| 674 |
_id: inpaint_image_artworks
|
| 675 |
arrange:
|
|
|
|
| 691 |
title: PaaS base url
|
| 692 |
type: string
|
| 693 |
scope: global
|
| 694 |
+
execution: regular
|
| 695 |
groups:
|
| 696 |
inputs:
|
| 697 |
mask:
|
|
|
|
| 1025 |
source: catalog
|
| 1026 |
title: en=Inpaint on image;ru=Улучшить изображение
|
| 1027 |
version: 1
|
|
|
|
| 1028 |
exctract_mask_on_image_artworks:
|
| 1029 |
_id: exctract_mask_on_image_artworks
|
| 1030 |
arrange:
|
|
|
|
| 1032 |
y: 50
|
| 1033 |
category:
|
| 1034 |
_id: image_analysis
|
|
|
|
| 1035 |
title: en=Image analysis;ru=Анализ изображений
|
| 1036 |
environment:
|
| 1037 |
OPEN_PAAS_USER:
|
|
|
|
| 1046 |
title: PaaS base url
|
| 1047 |
type: string
|
| 1048 |
scope: global
|
| 1049 |
+
execution: regular
|
| 1050 |
inputs:
|
| 1051 |
image:
|
| 1052 |
order: 1
|
|
|
|
| 1282 |
source: catalog
|
| 1283 |
title: en=Extract mask on image;ru=Выделить маску
|
| 1284 |
version: 1
|
| 1285 |
+
detect_face_on_image_artworks:
|
| 1286 |
+
_id: detect_face_on_image_artworks
|
| 1287 |
arrange:
|
| 1288 |
+
x: 1070
|
| 1289 |
+
y: 330
|
| 1290 |
category:
|
| 1291 |
+
_id: image_analysis
|
| 1292 |
+
title: en=Image analysis;ru=Анализ изображений
|
| 1293 |
environment:
|
| 1294 |
OPEN_PAAS_USER:
|
| 1295 |
title: PaaS user
|
|
|
|
| 1303 |
title: PaaS base url
|
| 1304 |
type: string
|
| 1305 |
scope: global
|
| 1306 |
+
execution: regular
|
| 1307 |
inputs:
|
| 1308 |
image:
|
| 1309 |
order: 1
|
| 1310 |
title: en=Image;ru=Изображение
|
| 1311 |
type: image
|
| 1312 |
required: true
|
| 1313 |
+
index:
|
| 1314 |
order: 2
|
| 1315 |
+
title: en=Index;ru=Индекс
|
| 1316 |
+
type: integer
|
| 1317 |
required: true
|
| 1318 |
+
default: 0
|
|
|
|
|
|
|
|
|
|
| 1319 |
outputs:
|
| 1320 |
+
face:
|
| 1321 |
+
title: en=Face;ru=Лицо
|
| 1322 |
type: image
|
| 1323 |
+
features:
|
| 1324 |
+
title: en=Features;ru=Характеристики
|
| 1325 |
+
type: json
|
| 1326 |
+
schema: face-features
|
| 1327 |
package: artworks
|
| 1328 |
+
script: |
|
| 1329 |
const CHECK_TASK_INTERVAL = 3000;
|
| 1330 |
+
const MAX_ATTEMPTS = 10;
|
| 1331 |
+
|
| 1332 |
+
const FIT_FACE_SIZE = 512;
|
| 1333 |
+
|
| 1334 |
+
export async function fit(image, { maxWidth, maxHeight }) {
|
| 1335 |
+
const { width, height } = await image.metadata();
|
| 1336 |
+
const orientation = width >= height ? "-" : "|";
|
| 1337 |
+
|
| 1338 |
+
const sharp = require('sharp/lib/index.js');
|
| 1339 |
+
|
| 1340 |
+
switch (orientation) {
|
| 1341 |
+
case "-":
|
| 1342 |
+
if (width > maxWidth) {
|
| 1343 |
+
return sharp(await image.resize({ width: maxWidth }).toBuffer());
|
| 1344 |
+
}
|
| 1345 |
+
break;
|
| 1346 |
+
case "|":
|
| 1347 |
+
if (height > maxHeight) {
|
| 1348 |
+
return sharp(await image.resize({ height: maxHeight }).toBuffer());
|
| 1349 |
+
}
|
| 1350 |
+
break;
|
| 1351 |
+
}
|
| 1352 |
+
|
| 1353 |
+
return image;
|
| 1354 |
+
}
|
| 1355 |
+
|
| 1356 |
+
export async function crop(source, face) {
|
| 1357 |
+
const sharp = require('sharp/lib/index.js');
|
| 1358 |
+
|
| 1359 |
+
const image = await sharp(source);
|
| 1360 |
+
const metadata = await image.metadata();
|
| 1361 |
+
|
| 1362 |
+
const UNCROP = 0.6;
|
| 1363 |
+
|
| 1364 |
+
let { x, y, width, height } = face;
|
| 1365 |
+
|
| 1366 |
+
const uncropX = width * UNCROP;
|
| 1367 |
+
const uncropY = height * UNCROP;
|
| 1368 |
+
|
| 1369 |
+
width = Math.round(width + uncropX);
|
| 1370 |
+
height = Math.round(height + uncropY);
|
| 1371 |
+
x = Math.round(x - uncropX / 2);
|
| 1372 |
+
y = Math.round(y - uncropY / 2);
|
| 1373 |
+
|
| 1374 |
+
const [left, top] = [Math.max(x, 0), Math.max(y, 0)];
|
| 1375 |
+
[width, height] = [
|
| 1376 |
+
Math.min(width, metadata.width - left),
|
| 1377 |
+
Math.min(height, metadata.height - top),
|
| 1378 |
+
];
|
| 1379 |
+
const size = Math.min(width, height);
|
| 1380 |
+
|
| 1381 |
+
const crop = {
|
| 1382 |
+
left,
|
| 1383 |
+
top,
|
| 1384 |
+
width: size,
|
| 1385 |
+
height: size,
|
| 1386 |
+
};
|
| 1387 |
+
|
| 1388 |
+
const area = await fit(await image.clone().extract(crop).webp(), {
|
| 1389 |
+
maxWidth: FIT_FACE_SIZE,
|
| 1390 |
+
maxHeight: FIT_FACE_SIZE,
|
| 1391 |
+
});
|
| 1392 |
+
|
| 1393 |
+
return area.toBuffer();
|
| 1394 |
+
}
|
| 1395 |
|
| 1396 |
export async function run({ inputs, state }) {
|
| 1397 |
|
|
|
|
| 1418 |
});
|
| 1419 |
|
| 1420 |
if (!state) {
|
| 1421 |
+
const { image, index } = inputs;
|
|
|
|
|
|
|
|
|
|
| 1422 |
|
| 1423 |
const payload = {
|
| 1424 |
+
type: "detect-faces",
|
| 1425 |
isFast: true,
|
| 1426 |
payload: {
|
| 1427 |
base64: false,
|
| 1428 |
image,
|
| 1429 |
+
features: ["age", "gender", "race", "emotion"],
|
| 1430 |
},
|
| 1431 |
};
|
| 1432 |
try {
|
|
|
|
| 1443 |
total: MAX_ATTEMPTS,
|
| 1444 |
processed: 0
|
| 1445 |
},
|
| 1446 |
+
delay: 2000
|
| 1447 |
});
|
| 1448 |
} catch (e) {
|
| 1449 |
if (e instanceof ArtWorksError) {
|
|
|
|
| 1488 |
},
|
| 1489 |
});
|
| 1490 |
}
|
| 1491 |
+
const { faces } = results;
|
| 1492 |
+
const { image, index } = inputs;
|
| 1493 |
+
const face = faces[index];
|
| 1494 |
+
if (!face) {
|
| 1495 |
+
throw new FatalError("Face with such index was not found");
|
| 1496 |
+
}
|
| 1497 |
+
const { x, y, width, height, ageFrom, ageTo, gender, race, emotion } = face;
|
| 1498 |
+
const { data } = await download(image);
|
| 1499 |
return NextNode.from({
|
| 1500 |
outputs: {
|
| 1501 |
+
face: await crop(data, {
|
| 1502 |
+
x,
|
| 1503 |
+
y,
|
| 1504 |
+
width,
|
| 1505 |
+
height,
|
| 1506 |
+
}),
|
| 1507 |
+
features: {
|
| 1508 |
+
ageFrom,
|
| 1509 |
+
ageTo,
|
| 1510 |
+
gender,
|
| 1511 |
+
race,
|
| 1512 |
+
emotion,
|
| 1513 |
+
},
|
| 1514 |
+
},
|
| 1515 |
});
|
| 1516 |
} catch (e) {
|
| 1517 |
if (e instanceof ArtWorksError) {
|
|
|
|
| 1522 |
}
|
| 1523 |
}
|
| 1524 |
source: catalog
|
| 1525 |
+
title: en=Detect face;ru=Определить лицо
|
| 1526 |
version: 1
|
| 1527 |
+
upscale_image_artworks:
|
| 1528 |
+
_id: upscale_image_artworks
|
|
|
|
| 1529 |
arrange:
|
| 1530 |
+
x: 470
|
| 1531 |
+
y: 400
|
| 1532 |
category:
|
| 1533 |
+
_id: generate_images
|
| 1534 |
+
title: en=Generate images;ru=Генерация изображений
|
| 1535 |
environment:
|
| 1536 |
OPEN_PAAS_USER:
|
| 1537 |
title: PaaS user
|
|
|
|
| 1545 |
title: PaaS base url
|
| 1546 |
type: string
|
| 1547 |
scope: global
|
| 1548 |
+
execution: regular
|
| 1549 |
inputs:
|
| 1550 |
image:
|
| 1551 |
order: 1
|
| 1552 |
title: en=Image;ru=Изображение
|
| 1553 |
type: image
|
| 1554 |
required: true
|
| 1555 |
+
upscalingResize:
|
| 1556 |
order: 2
|
| 1557 |
+
title: en=Resize;ru=Увеличение
|
| 1558 |
+
type: float
|
| 1559 |
required: true
|
| 1560 |
+
min: 0.1
|
| 1561 |
+
max: 4
|
| 1562 |
+
step: 0.1
|
| 1563 |
+
default: 2
|
| 1564 |
outputs:
|
| 1565 |
+
image:
|
| 1566 |
+
title: en=Image;ru=Изображение
|
| 1567 |
type: image
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1568 |
package: artworks
|
| 1569 |
+
script: |-
|
| 1570 |
const CHECK_TASK_INTERVAL = 3000;
|
| 1571 |
+
const MAX_ATTEMPTS = 20;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1572 |
|
| 1573 |
export async function run({ inputs, state }) {
|
| 1574 |
|
|
|
|
| 1595 |
});
|
| 1596 |
|
| 1597 |
if (!state) {
|
| 1598 |
+
const {
|
| 1599 |
+
image,
|
| 1600 |
+
upscalingResize,
|
| 1601 |
+
} = inputs;
|
| 1602 |
|
| 1603 |
const payload = {
|
| 1604 |
+
type: "upscale-image",
|
| 1605 |
isFast: true,
|
| 1606 |
payload: {
|
| 1607 |
base64: false,
|
| 1608 |
image,
|
| 1609 |
+
upscalingResize,
|
| 1610 |
},
|
| 1611 |
};
|
| 1612 |
try {
|
|
|
|
| 1623 |
total: MAX_ATTEMPTS,
|
| 1624 |
processed: 0
|
| 1625 |
},
|
| 1626 |
+
delay: 5000
|
| 1627 |
});
|
| 1628 |
} catch (e) {
|
| 1629 |
if (e instanceof ArtWorksError) {
|
|
|
|
| 1668 |
},
|
| 1669 |
});
|
| 1670 |
}
|
| 1671 |
+
let { image: { url: image } } = results;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1672 |
return NextNode.from({
|
| 1673 |
outputs: {
|
| 1674 |
+
image
|
| 1675 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1676 |
});
|
| 1677 |
} catch (e) {
|
| 1678 |
if (e instanceof ArtWorksError) {
|
|
|
|
| 1683 |
}
|
| 1684 |
}
|
| 1685 |
source: catalog
|
| 1686 |
+
title: en=Upscale image;ru=Увеличить изображение
|
| 1687 |
version: 1
|
|
|
|
| 1688 |
classify_image_artworks:
|
| 1689 |
_id: classify_image_artworks
|
| 1690 |
arrange:
|
|
|
|
| 1706 |
title: PaaS base url
|
| 1707 |
type: string
|
| 1708 |
scope: global
|
| 1709 |
+
execution: regular
|
| 1710 |
inputs:
|
| 1711 |
image:
|
| 1712 |
order: 1
|
|
|
|
| 1847 |
source: catalog
|
| 1848 |
title: en=Classify image;ru=Тегировать изображение
|
| 1849 |
version: 1
|
|
|
|
| 1850 |
translate_text_artworks:
|
| 1851 |
_id: translate_text_artworks
|
| 1852 |
arrange:
|
|
|
|
| 1868 |
title: PaaS base url
|
| 1869 |
type: string
|
| 1870 |
scope: global
|
| 1871 |
+
execution: regular
|
| 1872 |
inputs:
|
| 1873 |
source:
|
| 1874 |
order: 1
|
|
|
|
| 2047 |
source: catalog
|
| 2048 |
title: en=Translate text;ru=Перевести текст
|
| 2049 |
version: 1
|
|
|
|
| 2050 |
face_swap_on_image_artworks:
|
| 2051 |
_id: face_swap_on_image_artworks
|
| 2052 |
arrange:
|
|
|
|
| 2068 |
title: PaaS base url
|
| 2069 |
type: string
|
| 2070 |
scope: global
|
| 2071 |
+
execution: regular
|
| 2072 |
inputs:
|
| 2073 |
face:
|
| 2074 |
order: 1
|
|
|
|
| 2209 |
source: catalog
|
| 2210 |
title: en=Face swap on image;ru=Замена лица на изображении
|
| 2211 |
version: 1
|
|
|
|
| 2212 |
remove_background_artworks:
|
| 2213 |
_id: remove_background_artworks
|
| 2214 |
arrange:
|
|
|
|
| 2230 |
title: PaaS base url
|
| 2231 |
type: string
|
| 2232 |
scope: global
|
| 2233 |
+
execution: regular
|
| 2234 |
inputs:
|
| 2235 |
image:
|
| 2236 |
order: 1
|
|
|
|
| 2370 |
source: catalog
|
| 2371 |
title: en=Remove background;ru=Удалить фон
|
| 2372 |
version: 1
|
|
|
|
| 2373 |
outpaint_image_artworks:
|
| 2374 |
_id: outpaint_image_artworks
|
| 2375 |
arrange:
|
|
|
|
| 2391 |
title: PaaS base url
|
| 2392 |
type: string
|
| 2393 |
scope: global
|
| 2394 |
+
execution: regular
|
| 2395 |
groups:
|
| 2396 |
inputs:
|
| 2397 |
base:
|
|
|
|
| 2696 |
source: catalog
|
| 2697 |
title: en=Outpaint on image;ru=Расширить изображение
|
| 2698 |
version: 1
|
|
|
|
| 2699 |
ask_llm_artworks:
|
| 2700 |
_id: ask_llm_artworks
|
| 2701 |
arrange:
|
|
|
|
| 2717 |
title: PaaS base url
|
| 2718 |
type: string
|
| 2719 |
scope: global
|
| 2720 |
+
execution: regular
|
| 2721 |
inputs:
|
| 2722 |
model:
|
| 2723 |
order: 1
|
|
|
|
| 2879 |
source: catalog
|
| 2880 |
title: en=Ask LLM agent;ru=Спросить LLM
|
| 2881 |
version: 1
|
|
|
|
| 2882 |
ask_vlm_artworks:
|
| 2883 |
_id: ask_vlm_artworks
|
| 2884 |
arrange:
|
|
|
|
| 3057 |
title: PaaS base url
|
| 3058 |
type: string
|
| 3059 |
scope: global
|
| 3060 |
+
execution: regular
|
| 3061 |
inputs:
|
| 3062 |
image:
|
| 3063 |
order: 1
|
|
|
|
| 3183 |
source: catalog
|
| 3184 |
title: en=Detect NSFW;ru=Определить NSFW
|
| 3185 |
version: 1
|
|
|
|
| 3186 |
srore_aesthetics:
|
| 3187 |
_id: srore_aesthetics
|
| 3188 |
arrange:
|
|
|
|
| 3204 |
title: PaaS base url
|
| 3205 |
type: string
|
| 3206 |
scope: global
|
| 3207 |
+
execution: regular
|
| 3208 |
inputs:
|
| 3209 |
image:
|
| 3210 |
order: 1
|
|
|
|
| 3330 |
source: catalog
|
| 3331 |
title: en=Score aesthetics;ru=Оценить эстестику
|
| 3332 |
version: 1
|
|
|