Spaces:
Running
on
Zero
Running
on
Zero
refactor examples.py
Browse files- app.py +65 -350
- examples/examples.py +328 -0
app.py
CHANGED
@@ -31,6 +31,7 @@ from config import (
|
|
31 |
)
|
32 |
from models.vae import VAE_LIST as download_vae
|
33 |
from models.checkpoints import CHECKPOINT_LIST as download_model
|
|
|
34 |
|
35 |
preprocessor_controlnet = {
|
36 |
"openpose": [
|
@@ -797,12 +798,6 @@ def update_task_options(model_name, task_name):
|
|
797 |
|
798 |
with gr.Blocks(css=CSS) as app:
|
799 |
gr.Markdown("# 🧩 (Ivan) DiffuseCraft")
|
800 |
-
gr.Markdown(
|
801 |
-
f"""
|
802 |
-
### This demo uses [diffusers](https://github.com/huggingface/diffusers) \
|
803 |
-
to perform different tasks in image generation.
|
804 |
-
"""
|
805 |
-
)
|
806 |
with gr.Tab("Generation"):
|
807 |
with gr.Row():
|
808 |
|
@@ -1006,7 +1001,8 @@ with gr.Blocks(css=CSS) as app:
|
|
1006 |
|
1007 |
vae_model_gui = gr.Dropdown(
|
1008 |
label="VAE Model",
|
1009 |
-
choices=vae_model_list
|
|
|
1010 |
)
|
1011 |
|
1012 |
with gr.Accordion("Hires fix", open=False, visible=True):
|
@@ -1340,7 +1336,10 @@ with gr.Blocks(css=CSS) as app:
|
|
1340 |
|
1341 |
with gr.Accordion("Detailfix A", open=False, visible=True):
|
1342 |
# Adetailer A
|
1343 |
-
adetailer_active_a_gui = gr.Checkbox(
|
|
|
|
|
|
|
1344 |
prompt_ad_a_gui = gr.Textbox(
|
1345 |
label="Main prompt",
|
1346 |
placeholder="Main prompt will be use",
|
@@ -1357,12 +1356,33 @@ with gr.Blocks(css=CSS) as app:
|
|
1357 |
minimum=0.01,
|
1358 |
maximum=1.0
|
1359 |
)
|
1360 |
-
face_detector_ad_a_gui = gr.Checkbox(
|
1361 |
-
|
1362 |
-
|
1363 |
-
|
1364 |
-
|
1365 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1366 |
|
1367 |
with gr.Accordion("Detailfix B", open=False, visible=True):
|
1368 |
# Adetailer B
|
@@ -1391,11 +1411,26 @@ with gr.Blocks(css=CSS) as app:
|
|
1391 |
mask_blur_b_gui = gr.Number(label="Mask blur:", value=4, minimum=1)
|
1392 |
mask_padding_b_gui = gr.Number(label="Mask padding:", value=32, minimum=1)
|
1393 |
|
1394 |
-
with gr.Accordion(
|
1395 |
-
|
1396 |
-
|
1397 |
-
|
1398 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1399 |
|
1400 |
with gr.Accordion("More settings", open=False, visible=False):
|
1401 |
loop_generation_gui = gr.Slider(
|
@@ -1471,334 +1506,7 @@ with gr.Blocks(css=CSS) as app:
|
|
1471 |
"""
|
1472 |
)
|
1473 |
gr.Examples(
|
1474 |
-
examples=
|
1475 |
-
[
|
1476 |
-
"""
|
1477 |
-
1girl, loli, serious, cocky, sporty, basketball jersey, lakers, basketball, half body,
|
1478 |
-
(basketball court), sweaty, dribble, high detailed, sunny, day light,
|
1479 |
-
|
1480 |
-
score_9, score_8_up, score_7_up, very aesthetic,
|
1481 |
-
layered, white hair, featuring soft waves and a slight outward curl at the ends,
|
1482 |
-
parted in the middle, (short hair),
|
1483 |
-
red glowing eyes, beautiful hazel red eyes, highly detailed eyes, thin eyebrows,
|
1484 |
-
detailed black eyebrows,
|
1485 |
-
long eyelashes,
|
1486 |
-
detailed kornea,
|
1487 |
-
fisheye,
|
1488 |
-
blush,
|
1489 |
-
parted lips, gorgeous lips, pink thin lips,
|
1490 |
-
detailed ear, human ears, human ear, highly detailed ears, highly detailed ear, detailed ears,
|
1491 |
-
perfect anatomy,
|
1492 |
-
|
1493 |
-
five fingers,
|
1494 |
-
two hands,
|
1495 |
-
short girl, narrow body, detailed face, petite,
|
1496 |
-
medium boobs,
|
1497 |
-
armpits, (naval),
|
1498 |
-
""",
|
1499 |
-
"""
|
1500 |
-
(EasyNegative:1.05), easynegative, bad_prompt_version2, (poorly rendered), ugly, disfigured,
|
1501 |
-
cross eyed, cloned face, bad symmetry, bad anatomy, low quality, blurry, text, watermark, logo,
|
1502 |
-
signature, jpeg, artifacts, monochrome, paintings, oil, (hands:1.15), European Woman, woman,
|
1503 |
-
noise, dark skin, (3d), By bad artist -neg,bhands-neg, canvas frame,
|
1504 |
-
""",
|
1505 |
-
1,
|
1506 |
-
43,
|
1507 |
-
7.5,
|
1508 |
-
True,
|
1509 |
-
-1,
|
1510 |
-
"None",
|
1511 |
-
1.0,
|
1512 |
-
None,
|
1513 |
-
1.0,
|
1514 |
-
None,
|
1515 |
-
1.0,
|
1516 |
-
None,
|
1517 |
-
1.0,
|
1518 |
-
None,
|
1519 |
-
1.0,
|
1520 |
-
"DPM++ 2M Karras",
|
1521 |
-
1152,
|
1522 |
-
896,
|
1523 |
-
"cagliostrolab/animagine-xl-3.1",
|
1524 |
-
None, # vae
|
1525 |
-
"txt2img",
|
1526 |
-
None, # img conttol
|
1527 |
-
"Canny", # preprocessor
|
1528 |
-
512, # preproc resolution
|
1529 |
-
1024, # img resolution
|
1530 |
-
None, # Style prompt
|
1531 |
-
None, # Style json
|
1532 |
-
None, # img Mask
|
1533 |
-
0.35, # strength
|
1534 |
-
100, # low th canny
|
1535 |
-
200, # high th canny
|
1536 |
-
0.1, # value mstd
|
1537 |
-
0.1, # distance mstd
|
1538 |
-
1.0, # cn scale
|
1539 |
-
0., # cn start
|
1540 |
-
1., # cn end
|
1541 |
-
False, # ti
|
1542 |
-
"Classic",
|
1543 |
-
"Nearest",
|
1544 |
-
],
|
1545 |
-
[
|
1546 |
-
"""
|
1547 |
-
score_9, score_8_up, score_8, medium breasts, cute, eyelashes , princess Zelda OOT, cute
|
1548 |
-
small face, long hair, crown braid, hairclip, pointy ears, soft curvy body, solo,
|
1549 |
-
looking at viewer, smile, blush, white dress, medium body, (((holding the Master Sword))),
|
1550 |
-
standing, deep forest in the background
|
1551 |
-
""",
|
1552 |
-
"""
|
1553 |
-
score_6, score_5, score_4, busty, ugly face, mutated hands, low res,
|
1554 |
-
blurry face, black and white,
|
1555 |
-
""",
|
1556 |
-
1,
|
1557 |
-
30,
|
1558 |
-
5.,
|
1559 |
-
True,
|
1560 |
-
-1,
|
1561 |
-
"None",
|
1562 |
-
1.0,
|
1563 |
-
None,
|
1564 |
-
1.0,
|
1565 |
-
None,
|
1566 |
-
1.0,
|
1567 |
-
None,
|
1568 |
-
1.0,
|
1569 |
-
None,
|
1570 |
-
1.0,
|
1571 |
-
"DPM++ 2M Karras",
|
1572 |
-
1024,
|
1573 |
-
1024,
|
1574 |
-
"kitty7779/ponyDiffusionV6XL",
|
1575 |
-
None, # vae
|
1576 |
-
"txt2img",
|
1577 |
-
None, # img conttol
|
1578 |
-
"Canny", # preprocessor
|
1579 |
-
512, # preproc resolution
|
1580 |
-
1024, # img resolution
|
1581 |
-
None, # Style prompt
|
1582 |
-
None, # Style json
|
1583 |
-
None, # img Mask
|
1584 |
-
0.35, # strength
|
1585 |
-
100, # low th canny
|
1586 |
-
200, # high th canny
|
1587 |
-
0.1, # value mstd
|
1588 |
-
0.1, # distance mstd
|
1589 |
-
1.0, # cn scale
|
1590 |
-
0., # cn start
|
1591 |
-
1., # cn end
|
1592 |
-
False, # ti
|
1593 |
-
"Classic",
|
1594 |
-
"Nearest",
|
1595 |
-
],
|
1596 |
-
[
|
1597 |
-
"""
|
1598 |
-
((masterpiece)), best quality, blonde disco girl, detailed face, realistic face,
|
1599 |
-
realistic hair, dynamic pose, pink pvc, intergalactic disco background,
|
1600 |
-
pastel lights, dynamic contrast, airbrush, fine detail, 70s vibe, midriff
|
1601 |
-
""",
|
1602 |
-
"""
|
1603 |
-
(worst quality:1.2), (bad quality:1.2), (poor quality:1.2), (missing fingers:1.2),
|
1604 |
-
bad-artist-anime, bad-artist, bad-picture-chill-75v
|
1605 |
-
""",
|
1606 |
-
1,
|
1607 |
-
48,
|
1608 |
-
3.5,
|
1609 |
-
True,
|
1610 |
-
-1,
|
1611 |
-
"None",
|
1612 |
-
1.0,
|
1613 |
-
None,
|
1614 |
-
1.0,
|
1615 |
-
None,
|
1616 |
-
1.0,
|
1617 |
-
None,
|
1618 |
-
1.0,
|
1619 |
-
None,
|
1620 |
-
1.0,
|
1621 |
-
"DPM++ 2M SDE Lu",
|
1622 |
-
1024,
|
1623 |
-
1024,
|
1624 |
-
"misri/epicrealismXL_v7FinalDestination",
|
1625 |
-
None, # vae
|
1626 |
-
"canny ControlNet",
|
1627 |
-
"image.webp", # img conttol
|
1628 |
-
"Canny", # preprocessor
|
1629 |
-
1024, # preproc resolution
|
1630 |
-
1024, # img resolution
|
1631 |
-
None, # Style prompt
|
1632 |
-
None, # Style json
|
1633 |
-
None, # img Mask
|
1634 |
-
0.35, # strength
|
1635 |
-
100, # low th canny
|
1636 |
-
200, # high th canny
|
1637 |
-
0.1, # value mstd
|
1638 |
-
0.1, # distance mstd
|
1639 |
-
1.0, # cn scale
|
1640 |
-
0., # cn start
|
1641 |
-
1., # cn end
|
1642 |
-
False, # ti
|
1643 |
-
"Classic",
|
1644 |
-
None,
|
1645 |
-
],
|
1646 |
-
[
|
1647 |
-
"cinematic scenery old city ruins",
|
1648 |
-
"""
|
1649 |
-
(worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch),
|
1650 |
-
(illustration, 3d, 2d, painting, cartoons, sketch, blurry, film grain, noise),
|
1651 |
-
(low quality, worst quality:1.2)
|
1652 |
-
""",
|
1653 |
-
1,
|
1654 |
-
50,
|
1655 |
-
4.,
|
1656 |
-
True,
|
1657 |
-
-1,
|
1658 |
-
"None",
|
1659 |
-
1.0,
|
1660 |
-
None,
|
1661 |
-
1.0,
|
1662 |
-
None,
|
1663 |
-
1.0,
|
1664 |
-
None,
|
1665 |
-
1.0,
|
1666 |
-
None,
|
1667 |
-
1.0,
|
1668 |
-
"DPM++ 2M Karras",
|
1669 |
-
1024,
|
1670 |
-
1024,
|
1671 |
-
"misri/juggernautXL_juggernautX",
|
1672 |
-
None, # vae
|
1673 |
-
"optical pattern ControlNet",
|
1674 |
-
"spiral_no_transparent.png", # img conttol
|
1675 |
-
"Canny", # preprocessor
|
1676 |
-
512, # preproc resolution
|
1677 |
-
1024, # img resolution
|
1678 |
-
None, # Style prompt
|
1679 |
-
None, # Style json
|
1680 |
-
None, # img Mask
|
1681 |
-
0.35, # strength
|
1682 |
-
100, # low th canny
|
1683 |
-
200, # high th canny
|
1684 |
-
0.1, # value mstd
|
1685 |
-
0.1, # distance mstd
|
1686 |
-
1.0, # cn scale
|
1687 |
-
0.05, # cn start
|
1688 |
-
0.75, # cn end
|
1689 |
-
False, # ti
|
1690 |
-
"Classic",
|
1691 |
-
None,
|
1692 |
-
],
|
1693 |
-
[
|
1694 |
-
"""
|
1695 |
-
black and white, line art, coloring drawing, clean line art, black strokes, no background,
|
1696 |
-
white, black, free lines, black scribbles, on paper,
|
1697 |
-
A blend of comic book art and lineart full of black and white color, masterpiece,
|
1698 |
-
high-resolution, trending on Pixiv fan box, palette knife, brush strokes, two-dimensional,
|
1699 |
-
planar vector, T-shirt design, stickers, and T-shirt design, vector art, fantasy art,
|
1700 |
-
Adobe Illustrator, hand-painted, digital painting, low polygon, soft lighting, aerial view,
|
1701 |
-
isometric style, retro aesthetics, 8K resolution, black sketch lines, monochrome, invert color
|
1702 |
-
""",
|
1703 |
-
"""
|
1704 |
-
color, red, green, yellow, colored, duplicate, blurry, abstract, disfigured, deformed,
|
1705 |
-
animated, toy, figure, framed, 3d, bad art, poorly drawn, extra limbs, close up, b&w,
|
1706 |
-
weird colors, blurry, watermark, blur haze, 2 heads, long neck, watermark, elongated body,
|
1707 |
-
cropped image, out of frame, draft, deformed hands, twisted fingers, double image,
|
1708 |
-
malformed hands, multiple heads, extra limb, ugly, poorly drawn hands, missing limb,
|
1709 |
-
cut-off, over satured, grain, lowères, bad anatomy, poorly drawn face, mutation, mutated,
|
1710 |
-
floating limbs, disconnected limbs, out of focus, long body, disgusting, extra fingers,
|
1711 |
-
groos proportions, missing arms, mutated hands, cloned face, missing legs, ugly, tiling,
|
1712 |
-
poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs,
|
1713 |
-
disfigured, deformed, body out of frame, blurry, bad anatomy, blurred, watermark, grainy,
|
1714 |
-
signature, cut off, draft, deformed, blurry, bad anatomy, disfigured, poorly drawn face,
|
1715 |
-
mutation, bluelish, blue
|
1716 |
-
|
1717 |
-
""",
|
1718 |
-
1,
|
1719 |
-
20,
|
1720 |
-
4.,
|
1721 |
-
True,
|
1722 |
-
-1,
|
1723 |
-
"loras/Coloring_book_-_LineArt.safetensors",
|
1724 |
-
1.0,
|
1725 |
-
None,
|
1726 |
-
1.0,
|
1727 |
-
None,
|
1728 |
-
1.0,
|
1729 |
-
None,
|
1730 |
-
1.0,
|
1731 |
-
None,
|
1732 |
-
1.0,
|
1733 |
-
"DPM++ 2M SDE Karras",
|
1734 |
-
1024,
|
1735 |
-
1024,
|
1736 |
-
"cagliostrolab/animagine-xl-3.1",
|
1737 |
-
None, # vae
|
1738 |
-
"lineart ControlNet",
|
1739 |
-
"color_image.png", # img conttol
|
1740 |
-
"Lineart", # preprocessor
|
1741 |
-
512, # preproc resolution
|
1742 |
-
896, # img resolution
|
1743 |
-
None, # Style prompt
|
1744 |
-
None, # Style json
|
1745 |
-
None, # img Mask
|
1746 |
-
0.35, # strength
|
1747 |
-
100, # low th canny
|
1748 |
-
200, # high th canny
|
1749 |
-
0.1, # value mstd
|
1750 |
-
0.1, # distance mstd
|
1751 |
-
1.0, # cn scale
|
1752 |
-
0., # cn start
|
1753 |
-
1., # cn end
|
1754 |
-
False, # ti
|
1755 |
-
"Compel",
|
1756 |
-
None,
|
1757 |
-
],
|
1758 |
-
[
|
1759 |
-
"1girl,face,curly hair,red hair,white background,",
|
1760 |
-
"(worst quality:2),(low quality:2),(normal quality:2),lowres,watermark,",
|
1761 |
-
1,
|
1762 |
-
38,
|
1763 |
-
5.,
|
1764 |
-
True,
|
1765 |
-
-1,
|
1766 |
-
"None",
|
1767 |
-
1.0,
|
1768 |
-
None,
|
1769 |
-
1.0,
|
1770 |
-
None,
|
1771 |
-
1.0,
|
1772 |
-
None,
|
1773 |
-
1.0,
|
1774 |
-
None,
|
1775 |
-
1.0,
|
1776 |
-
"DPM++ 2M SDE Karras",
|
1777 |
-
512,
|
1778 |
-
512,
|
1779 |
-
"digiplay/majicMIX_realistic_v7",
|
1780 |
-
None, # vae
|
1781 |
-
"openpose ControlNet",
|
1782 |
-
"image.webp", # img conttol
|
1783 |
-
"Canny", # preprocessor
|
1784 |
-
512, # preproc resolution
|
1785 |
-
1024, # img resolution
|
1786 |
-
None, # Style prompt
|
1787 |
-
None, # Style json
|
1788 |
-
None, # img Mask
|
1789 |
-
0.35, # strength
|
1790 |
-
100, # low th canny
|
1791 |
-
200, # high th canny
|
1792 |
-
0.1, # value mstd
|
1793 |
-
0.1, # distance mstd
|
1794 |
-
1.0, # cn scale
|
1795 |
-
0., # cn start
|
1796 |
-
0.9, # cn end
|
1797 |
-
False, # ti
|
1798 |
-
"Compel",
|
1799 |
-
"Nearest",
|
1800 |
-
],
|
1801 |
-
],
|
1802 |
fn=sd_gen.generate_pipeline,
|
1803 |
inputs=[
|
1804 |
prompt_gui,
|
@@ -1881,7 +1589,10 @@ with gr.Blocks(css=CSS) as app:
|
|
1881 |
with gr.Column(scale=2):
|
1882 |
# image_base = gr.ImageEditor(label="Base image", show_label=True, brush=gr.Brush(colors=["#000000"]))
|
1883 |
image_base = gr.ImageEditor(
|
1884 |
-
sources=[
|
|
|
|
|
|
|
1885 |
# crop_size="1:1",
|
1886 |
# enable crop (or disable it)
|
1887 |
# transforms=["crop"],
|
@@ -1902,7 +1613,11 @@ with gr.Blocks(css=CSS) as app:
|
|
1902 |
btn = gr.Button("Create mask")
|
1903 |
with gr.Column(scale=1):
|
1904 |
img_source = gr.Image(interactive=False)
|
1905 |
-
img_result = gr.Image(
|
|
|
|
|
|
|
|
|
1906 |
btn_send = gr.Button("Send to the first tab")
|
1907 |
|
1908 |
btn.click(
|
@@ -2047,4 +1762,4 @@ app.queue()
|
|
2047 |
app.launch(
|
2048 |
show_error=True,
|
2049 |
debug=True,
|
2050 |
-
)
|
|
|
31 |
)
|
32 |
from models.vae import VAE_LIST as download_vae
|
33 |
from models.checkpoints import CHECKPOINT_LIST as download_model
|
34 |
+
from examples.examples import example_prompts
|
35 |
|
36 |
preprocessor_controlnet = {
|
37 |
"openpose": [
|
|
|
798 |
|
799 |
with gr.Blocks(css=CSS) as app:
|
800 |
gr.Markdown("# 🧩 (Ivan) DiffuseCraft")
|
|
|
|
|
|
|
|
|
|
|
|
|
801 |
with gr.Tab("Generation"):
|
802 |
with gr.Row():
|
803 |
|
|
|
1001 |
|
1002 |
vae_model_gui = gr.Dropdown(
|
1003 |
label="VAE Model",
|
1004 |
+
choices=vae_model_list,
|
1005 |
+
value=vae_model_list[0]
|
1006 |
)
|
1007 |
|
1008 |
with gr.Accordion("Hires fix", open=False, visible=True):
|
|
|
1336 |
|
1337 |
with gr.Accordion("Detailfix A", open=False, visible=True):
|
1338 |
# Adetailer A
|
1339 |
+
adetailer_active_a_gui = gr.Checkbox(
|
1340 |
+
label="Enable Adetailer A",
|
1341 |
+
value=False
|
1342 |
+
)
|
1343 |
prompt_ad_a_gui = gr.Textbox(
|
1344 |
label="Main prompt",
|
1345 |
placeholder="Main prompt will be use",
|
|
|
1356 |
minimum=0.01,
|
1357 |
maximum=1.0
|
1358 |
)
|
1359 |
+
face_detector_ad_a_gui = gr.Checkbox(
|
1360 |
+
label="Face detector",
|
1361 |
+
value=True
|
1362 |
+
)
|
1363 |
+
person_detector_ad_a_gui = gr.Checkbox(
|
1364 |
+
label="Person detector",
|
1365 |
+
value=True
|
1366 |
+
)
|
1367 |
+
hand_detector_ad_a_gui = gr.Checkbox(
|
1368 |
+
label="Hand detector",
|
1369 |
+
value=False
|
1370 |
+
)
|
1371 |
+
mask_dilation_a_gui = gr.Number(
|
1372 |
+
label="Mask dilation:",
|
1373 |
+
value=4,
|
1374 |
+
minimum=1
|
1375 |
+
)
|
1376 |
+
mask_blur_a_gui = gr.Number(
|
1377 |
+
label="Mask blur:",
|
1378 |
+
value=4,
|
1379 |
+
minimum=1
|
1380 |
+
)
|
1381 |
+
mask_padding_a_gui = gr.Number(
|
1382 |
+
label="Mask padding:",
|
1383 |
+
value=32,
|
1384 |
+
minimum=1
|
1385 |
+
)
|
1386 |
|
1387 |
with gr.Accordion("Detailfix B", open=False, visible=True):
|
1388 |
# Adetailer B
|
|
|
1411 |
mask_blur_b_gui = gr.Number(label="Mask blur:", value=4, minimum=1)
|
1412 |
mask_padding_b_gui = gr.Number(label="Mask padding:", value=32, minimum=1)
|
1413 |
|
1414 |
+
with gr.Accordion(
|
1415 |
+
"Other settings",
|
1416 |
+
open=False,
|
1417 |
+
visible=True):
|
1418 |
+
image_previews_gui = gr.Checkbox(
|
1419 |
+
value=True,
|
1420 |
+
label="Image Previews"
|
1421 |
+
)
|
1422 |
+
hires_before_adetailer_gui = gr.Checkbox(
|
1423 |
+
value=False,
|
1424 |
+
label="Hires Before Adetailer"
|
1425 |
+
)
|
1426 |
+
hires_after_adetailer_gui = gr.Checkbox(
|
1427 |
+
value=True,
|
1428 |
+
label="Hires After Adetailer"
|
1429 |
+
)
|
1430 |
+
generator_in_cpu_gui = gr.Checkbox(
|
1431 |
+
value=False,
|
1432 |
+
label="Generator in CPU"
|
1433 |
+
)
|
1434 |
|
1435 |
with gr.Accordion("More settings", open=False, visible=False):
|
1436 |
loop_generation_gui = gr.Slider(
|
|
|
1506 |
"""
|
1507 |
)
|
1508 |
gr.Examples(
|
1509 |
+
examples=example_prompts,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1510 |
fn=sd_gen.generate_pipeline,
|
1511 |
inputs=[
|
1512 |
prompt_gui,
|
|
|
1589 |
with gr.Column(scale=2):
|
1590 |
# image_base = gr.ImageEditor(label="Base image", show_label=True, brush=gr.Brush(colors=["#000000"]))
|
1591 |
image_base = gr.ImageEditor(
|
1592 |
+
sources=[
|
1593 |
+
"upload",
|
1594 |
+
"clipboard"
|
1595 |
+
],
|
1596 |
# crop_size="1:1",
|
1597 |
# enable crop (or disable it)
|
1598 |
# transforms=["crop"],
|
|
|
1613 |
btn = gr.Button("Create mask")
|
1614 |
with gr.Column(scale=1):
|
1615 |
img_source = gr.Image(interactive=False)
|
1616 |
+
img_result = gr.Image(
|
1617 |
+
label="Mask image",
|
1618 |
+
show_label=True,
|
1619 |
+
interactive=False
|
1620 |
+
)
|
1621 |
btn_send = gr.Button("Send to the first tab")
|
1622 |
|
1623 |
btn.click(
|
|
|
1762 |
app.launch(
|
1763 |
show_error=True,
|
1764 |
debug=True,
|
1765 |
+
)
|
examples/examples.py
ADDED
@@ -0,0 +1,328 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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4 |
+
1girl, loli, serious, cocky, sporty, basketball jersey, lakers, basketball, half body,
|
5 |
+
(basketball court), sweaty, dribble, high detailed, sunny, day light,
|
6 |
+
|
7 |
+
score_9, score_8_up, score_7_up, very aesthetic,
|
8 |
+
layered, white hair, featuring soft waves and a slight outward curl at the ends,
|
9 |
+
parted in the middle, (short hair),
|
10 |
+
red glowing eyes, beautiful hazel red eyes, highly detailed eyes, thin eyebrows,
|
11 |
+
detailed black eyebrows,
|
12 |
+
long eyelashes,
|
13 |
+
detailed kornea,
|
14 |
+
fisheye,
|
15 |
+
blush,
|
16 |
+
parted lips, gorgeous lips, pink thin lips,
|
17 |
+
detailed ear, human ears, human ear, highly detailed ears, highly detailed ear, detailed ears,
|
18 |
+
perfect anatomy,
|
19 |
+
|
20 |
+
five fingers,
|
21 |
+
two hands,
|
22 |
+
short girl, narrow body, detailed face, petite,
|
23 |
+
medium boobs,
|
24 |
+
armpits, (naval),
|
25 |
+
""",
|
26 |
+
"""
|
27 |
+
(EasyNegative:1.05), easynegative, bad_prompt_version2, (poorly rendered), ugly, disfigured,
|
28 |
+
cross eyed, cloned face, bad symmetry, bad anatomy, low quality, blurry, text, watermark, logo,
|
29 |
+
signature, jpeg, artifacts, monochrome, paintings, oil, (hands:1.15), European Woman, woman,
|
30 |
+
noise, dark skin, (3d), By bad artist -neg,bhands-neg, canvas frame,
|
31 |
+
""",
|
32 |
+
1,
|
33 |
+
43,
|
34 |
+
7.5,
|
35 |
+
True,
|
36 |
+
-1,
|
37 |
+
"None",
|
38 |
+
1.0,
|
39 |
+
None,
|
40 |
+
1.0,
|
41 |
+
None,
|
42 |
+
1.0,
|
43 |
+
None,
|
44 |
+
1.0,
|
45 |
+
None,
|
46 |
+
1.0,
|
47 |
+
"DPM++ 2M Karras",
|
48 |
+
1152,
|
49 |
+
896,
|
50 |
+
"cagliostrolab/animagine-xl-3.1",
|
51 |
+
None, # vae
|
52 |
+
"txt2img",
|
53 |
+
None, # img conttol
|
54 |
+
"Canny", # preprocessor
|
55 |
+
512, # preproc resolution
|
56 |
+
1024, # img resolution
|
57 |
+
None, # Style prompt
|
58 |
+
None, # Style json
|
59 |
+
None, # img Mask
|
60 |
+
0.35, # strength
|
61 |
+
100, # low th canny
|
62 |
+
200, # high th canny
|
63 |
+
0.1, # value mstd
|
64 |
+
0.1, # distance mstd
|
65 |
+
1.0, # cn scale
|
66 |
+
0., # cn start
|
67 |
+
1., # cn end
|
68 |
+
False, # ti
|
69 |
+
"Classic",
|
70 |
+
"Nearest",
|
71 |
+
],
|
72 |
+
[
|
73 |
+
"""
|
74 |
+
score_9, score_8_up, score_8, medium breasts, cute, eyelashes , princess Zelda OOT, cute
|
75 |
+
small face, long hair, crown braid, hairclip, pointy ears, soft curvy body, solo,
|
76 |
+
looking at viewer, smile, blush, white dress, medium body, (((holding the Master Sword))),
|
77 |
+
standing, deep forest in the background
|
78 |
+
""",
|
79 |
+
"""
|
80 |
+
score_6, score_5, score_4, busty, ugly face, mutated hands, low res,
|
81 |
+
blurry face, black and white,
|
82 |
+
""",
|
83 |
+
1,
|
84 |
+
30,
|
85 |
+
5.,
|
86 |
+
True,
|
87 |
+
-1,
|
88 |
+
"None",
|
89 |
+
1.0,
|
90 |
+
None,
|
91 |
+
1.0,
|
92 |
+
None,
|
93 |
+
1.0,
|
94 |
+
None,
|
95 |
+
1.0,
|
96 |
+
None,
|
97 |
+
1.0,
|
98 |
+
"DPM++ 2M Karras",
|
99 |
+
1024,
|
100 |
+
1024,
|
101 |
+
"kitty7779/ponyDiffusionV6XL",
|
102 |
+
None, # vae
|
103 |
+
"txt2img",
|
104 |
+
None, # img conttol
|
105 |
+
"Canny", # preprocessor
|
106 |
+
512, # preproc resolution
|
107 |
+
1024, # img resolution
|
108 |
+
None, # Style prompt
|
109 |
+
None, # Style json
|
110 |
+
None, # img Mask
|
111 |
+
0.35, # strength
|
112 |
+
100, # low th canny
|
113 |
+
200, # high th canny
|
114 |
+
0.1, # value mstd
|
115 |
+
0.1, # distance mstd
|
116 |
+
1.0, # cn scale
|
117 |
+
0., # cn start
|
118 |
+
1., # cn end
|
119 |
+
False, # ti
|
120 |
+
"Classic",
|
121 |
+
"Nearest",
|
122 |
+
],
|
123 |
+
[
|
124 |
+
"""
|
125 |
+
((masterpiece)), best quality, blonde disco girl, detailed face, realistic face,
|
126 |
+
realistic hair, dynamic pose, pink pvc, intergalactic disco background,
|
127 |
+
pastel lights, dynamic contrast, airbrush, fine detail, 70s vibe, midriff
|
128 |
+
""",
|
129 |
+
"""
|
130 |
+
(worst quality:1.2), (bad quality:1.2), (poor quality:1.2), (missing fingers:1.2),
|
131 |
+
bad-artist-anime, bad-artist, bad-picture-chill-75v
|
132 |
+
""",
|
133 |
+
1,
|
134 |
+
48,
|
135 |
+
3.5,
|
136 |
+
True,
|
137 |
+
-1,
|
138 |
+
"None",
|
139 |
+
1.0,
|
140 |
+
None,
|
141 |
+
1.0,
|
142 |
+
None,
|
143 |
+
1.0,
|
144 |
+
None,
|
145 |
+
1.0,
|
146 |
+
None,
|
147 |
+
1.0,
|
148 |
+
"DPM++ 2M SDE Lu",
|
149 |
+
1024,
|
150 |
+
1024,
|
151 |
+
"misri/epicrealismXL_v7FinalDestination",
|
152 |
+
None, # vae
|
153 |
+
"canny ControlNet",
|
154 |
+
"image.webp", # img conttol
|
155 |
+
"Canny", # preprocessor
|
156 |
+
1024, # preproc resolution
|
157 |
+
1024, # img resolution
|
158 |
+
None, # Style prompt
|
159 |
+
None, # Style json
|
160 |
+
None, # img Mask
|
161 |
+
0.35, # strength
|
162 |
+
100, # low th canny
|
163 |
+
200, # high th canny
|
164 |
+
0.1, # value mstd
|
165 |
+
0.1, # distance mstd
|
166 |
+
1.0, # cn scale
|
167 |
+
0., # cn start
|
168 |
+
1., # cn end
|
169 |
+
False, # ti
|
170 |
+
"Classic",
|
171 |
+
None,
|
172 |
+
],
|
173 |
+
[
|
174 |
+
"cinematic scenery old city ruins",
|
175 |
+
"""
|
176 |
+
(worst quality, low quality, illustration, 3d, 2d, painting, cartoons, sketch),
|
177 |
+
(illustration, 3d, 2d, painting, cartoons, sketch, blurry, film grain, noise),
|
178 |
+
(low quality, worst quality:1.2)
|
179 |
+
""",
|
180 |
+
1,
|
181 |
+
50,
|
182 |
+
4.,
|
183 |
+
True,
|
184 |
+
-1,
|
185 |
+
"None",
|
186 |
+
1.0,
|
187 |
+
None,
|
188 |
+
1.0,
|
189 |
+
None,
|
190 |
+
1.0,
|
191 |
+
None,
|
192 |
+
1.0,
|
193 |
+
None,
|
194 |
+
1.0,
|
195 |
+
"DPM++ 2M Karras",
|
196 |
+
1024,
|
197 |
+
1024,
|
198 |
+
"misri/juggernautXL_juggernautX",
|
199 |
+
None, # vae
|
200 |
+
"optical pattern ControlNet",
|
201 |
+
"spiral_no_transparent.png", # img conttol
|
202 |
+
"Canny", # preprocessor
|
203 |
+
512, # preproc resolution
|
204 |
+
1024, # img resolution
|
205 |
+
None, # Style prompt
|
206 |
+
None, # Style json
|
207 |
+
None, # img Mask
|
208 |
+
0.35, # strength
|
209 |
+
100, # low th canny
|
210 |
+
200, # high th canny
|
211 |
+
0.1, # value mstd
|
212 |
+
0.1, # distance mstd
|
213 |
+
1.0, # cn scale
|
214 |
+
0.05, # cn start
|
215 |
+
0.75, # cn end
|
216 |
+
False, # ti
|
217 |
+
"Classic",
|
218 |
+
None,
|
219 |
+
],
|
220 |
+
[
|
221 |
+
"""
|
222 |
+
black and white, line art, coloring drawing, clean line art, black strokes, no background,
|
223 |
+
white, black, free lines, black scribbles, on paper,
|
224 |
+
A blend of comic book art and lineart full of black and white color, masterpiece,
|
225 |
+
high-resolution, trending on Pixiv fan box, palette knife, brush strokes, two-dimensional,
|
226 |
+
planar vector, T-shirt design, stickers, and T-shirt design, vector art, fantasy art,
|
227 |
+
Adobe Illustrator, hand-painted, digital painting, low polygon, soft lighting, aerial view,
|
228 |
+
isometric style, retro aesthetics, 8K resolution, black sketch lines, monochrome, invert color
|
229 |
+
""",
|
230 |
+
"""
|
231 |
+
color, red, green, yellow, colored, duplicate, blurry, abstract, disfigured, deformed,
|
232 |
+
animated, toy, figure, framed, 3d, bad art, poorly drawn, extra limbs, close up, b&w,
|
233 |
+
weird colors, blurry, watermark, blur haze, 2 heads, long neck, watermark, elongated body,
|
234 |
+
cropped image, out of frame, draft, deformed hands, twisted fingers, double image,
|
235 |
+
malformed hands, multiple heads, extra limb, ugly, poorly drawn hands, missing limb,
|
236 |
+
cut-off, over satured, grain, lowères, bad anatomy, poorly drawn face, mutation, mutated,
|
237 |
+
floating limbs, disconnected limbs, out of focus, long body, disgusting, extra fingers,
|
238 |
+
groos proportions, missing arms, mutated hands, cloned face, missing legs, ugly, tiling,
|
239 |
+
poorly drawn hands, poorly drawn feet, poorly drawn face, out of frame, extra limbs,
|
240 |
+
disfigured, deformed, body out of frame, blurry, bad anatomy, blurred, watermark, grainy,
|
241 |
+
signature, cut off, draft, deformed, blurry, bad anatomy, disfigured, poorly drawn face,
|
242 |
+
mutation, bluelish, blue
|
243 |
+
|
244 |
+
""",
|
245 |
+
1,
|
246 |
+
20,
|
247 |
+
4.,
|
248 |
+
True,
|
249 |
+
-1,
|
250 |
+
"loras/Coloring_book_-_LineArt.safetensors",
|
251 |
+
1.0,
|
252 |
+
None,
|
253 |
+
1.0,
|
254 |
+
None,
|
255 |
+
1.0,
|
256 |
+
None,
|
257 |
+
1.0,
|
258 |
+
None,
|
259 |
+
1.0,
|
260 |
+
"DPM++ 2M SDE Karras",
|
261 |
+
1024,
|
262 |
+
1024,
|
263 |
+
"cagliostrolab/animagine-xl-3.1",
|
264 |
+
None, # vae
|
265 |
+
"lineart ControlNet",
|
266 |
+
"color_image.png", # img conttol
|
267 |
+
"Lineart", # preprocessor
|
268 |
+
512, # preproc resolution
|
269 |
+
896, # img resolution
|
270 |
+
None, # Style prompt
|
271 |
+
None, # Style json
|
272 |
+
None, # img Mask
|
273 |
+
0.35, # strength
|
274 |
+
100, # low th canny
|
275 |
+
200, # high th canny
|
276 |
+
0.1, # value mstd
|
277 |
+
0.1, # distance mstd
|
278 |
+
1.0, # cn scale
|
279 |
+
0., # cn start
|
280 |
+
1., # cn end
|
281 |
+
False, # ti
|
282 |
+
"Compel",
|
283 |
+
None,
|
284 |
+
],
|
285 |
+
[
|
286 |
+
"1girl,face,curly hair,red hair,white background,",
|
287 |
+
"(worst quality:2),(low quality:2),(normal quality:2),lowres,watermark,",
|
288 |
+
1,
|
289 |
+
38,
|
290 |
+
5.,
|
291 |
+
True,
|
292 |
+
-1,
|
293 |
+
"None",
|
294 |
+
1.0,
|
295 |
+
None,
|
296 |
+
1.0,
|
297 |
+
None,
|
298 |
+
1.0,
|
299 |
+
None,
|
300 |
+
1.0,
|
301 |
+
None,
|
302 |
+
1.0,
|
303 |
+
"DPM++ 2M SDE Karras",
|
304 |
+
512,
|
305 |
+
512,
|
306 |
+
"digiplay/majicMIX_realistic_v7",
|
307 |
+
None, # vae
|
308 |
+
"openpose ControlNet",
|
309 |
+
"image.webp", # img conttol
|
310 |
+
"Canny", # preprocessor
|
311 |
+
512, # preproc resolution
|
312 |
+
1024, # img resolution
|
313 |
+
None, # Style prompt
|
314 |
+
None, # Style json
|
315 |
+
None, # img Mask
|
316 |
+
0.35, # strength
|
317 |
+
100, # low th canny
|
318 |
+
200, # high th canny
|
319 |
+
0.1, # value mstd
|
320 |
+
0.1, # distance mstd
|
321 |
+
1.0, # cn scale
|
322 |
+
0., # cn start
|
323 |
+
0.9, # cn end
|
324 |
+
False, # ti
|
325 |
+
"Compel",
|
326 |
+
"Nearest",
|
327 |
+
],
|
328 |
+
],
|