Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,6 @@ function refresh() {
|
|
22 |
const url = new URL(window.location);
|
23 |
}
|
24 |
"""
|
25 |
-
|
26 |
def nms(x, t, s):
|
27 |
x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
|
28 |
|
@@ -64,7 +63,56 @@ if not torch.cuda.is_available():
|
|
64 |
DESCRIPTION += ""
|
65 |
|
66 |
style_list = [
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
]
|
69 |
|
70 |
styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
|
@@ -107,6 +155,22 @@ pipe_stallion = StableDiffusionXLControlNetPipeline.from_pretrained(
|
|
107 |
|
108 |
MAX_SEED = np.iinfo(np.int32).max
|
109 |
processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
|
111 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
112 |
if randomize_seed:
|
|
|
22 |
const url = new URL(window.location);
|
23 |
}
|
24 |
"""
|
|
|
25 |
def nms(x, t, s):
|
26 |
x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
|
27 |
|
|
|
63 |
DESCRIPTION += ""
|
64 |
|
65 |
style_list = [
|
66 |
+
{
|
67 |
+
"name": "(No style)",
|
68 |
+
"prompt": "{prompt}",
|
69 |
+
"negative_prompt": "longbody, lowres, bad anatomy, bad hands, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality",
|
70 |
+
},
|
71 |
+
{
|
72 |
+
"name": "Cinematic",
|
73 |
+
"prompt": "cinematic still {prompt} . emotional, harmonious, vignette, highly detailed, high budget, bokeh, cinemascope, moody, epic, gorgeous, film grain, grainy",
|
74 |
+
"negative_prompt": "anime, cartoon, graphic, text, painting, crayon, graphite, abstract, glitch, deformed, mutated, ugly, disfigured",
|
75 |
+
},
|
76 |
+
{
|
77 |
+
"name": "3D Model",
|
78 |
+
"prompt": "professional 3d model {prompt} . octane render, highly detailed, volumetric, dramatic lighting",
|
79 |
+
"negative_prompt": "ugly, deformed, noisy, low poly, blurry, painting",
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"name": "Anime",
|
83 |
+
"prompt": "anime artwork {prompt} . anime style, key visual, vibrant, studio anime, highly detailed",
|
84 |
+
"negative_prompt": "photo, deformed, black and white, realism, disfigured, low contrast",
|
85 |
+
},
|
86 |
+
{
|
87 |
+
"name": "Digital Art",
|
88 |
+
"prompt": "concept art {prompt} . digital artwork, illustrative, painterly, matte painting, highly detailed",
|
89 |
+
"negative_prompt": "photo, photorealistic, realism, ugly",
|
90 |
+
},
|
91 |
+
{
|
92 |
+
"name": "Photographic",
|
93 |
+
"prompt": "cinematic photo {prompt} . 35mm photograph, film, bokeh, professional, 4k, highly detailed",
|
94 |
+
"negative_prompt": "drawing, painting, crayon, sketch, graphite, impressionist, noisy, blurry, soft, deformed, ugly",
|
95 |
+
},
|
96 |
+
{
|
97 |
+
"name": "Pixel art",
|
98 |
+
"prompt": "pixel-art {prompt} . low-res, blocky, pixel art style, 8-bit graphics",
|
99 |
+
"negative_prompt": "sloppy, messy, blurry, noisy, highly detailed, ultra textured, photo, realistic",
|
100 |
+
},
|
101 |
+
{
|
102 |
+
"name": "Fantasy art",
|
103 |
+
"prompt": "ethereal fantasy concept art of {prompt} . magnificent, celestial, ethereal, painterly, epic, majestic, magical, fantasy art, cover art, dreamy",
|
104 |
+
"negative_prompt": "photographic, realistic, realism, 35mm film, dslr, cropped, frame, text, deformed, glitch, noise, noisy, off-center, deformed, cross-eyed, closed eyes, bad anatomy, ugly, disfigured, sloppy, duplicate, mutated, black and white",
|
105 |
+
},
|
106 |
+
{
|
107 |
+
"name": "Neonpunk",
|
108 |
+
"prompt": "neonpunk style {prompt} . cyberpunk, vaporwave, neon, vibes, vibrant, stunningly beautiful, crisp, detailed, sleek, ultramodern, magenta highlights, dark purple shadows, high contrast, cinematic, ultra detailed, intricate, professional",
|
109 |
+
"negative_prompt": "painting, drawing, illustration, glitch, deformed, mutated, cross-eyed, ugly, disfigured",
|
110 |
+
},
|
111 |
+
{
|
112 |
+
"name": "Manga",
|
113 |
+
"prompt": "manga style {prompt} . vibrant, high-energy, detailed, iconic, Japanese comic style",
|
114 |
+
"negative_prompt": "ugly, deformed, noisy, blurry, low contrast, realism, photorealistic, Western comic style",
|
115 |
+
},
|
116 |
]
|
117 |
|
118 |
styles = {k["name"]: (k["prompt"], k["negative_prompt"]) for k in style_list}
|
|
|
155 |
|
156 |
MAX_SEED = np.iinfo(np.int32).max
|
157 |
processor = HEDdetector.from_pretrained('lllyasviel/Annotators')
|
158 |
+
def nms(x, t, s):
|
159 |
+
x = cv2.GaussianBlur(x.astype(np.float32), (0, 0), s)
|
160 |
+
|
161 |
+
f1 = np.array([[0, 0, 0], [1, 1, 1], [0, 0, 0]], dtype=np.uint8)
|
162 |
+
f2 = np.array([[0, 1, 0], [0, 1, 0], [0, 1, 0]], dtype=np.uint8)
|
163 |
+
f3 = np.array([[1, 0, 0], [0, 1, 0], [0, 0, 1]], dtype=np.uint8)
|
164 |
+
f4 = np.array([[0, 0, 1], [0, 1, 0], [1, 0, 0]], dtype=np.uint8)
|
165 |
+
|
166 |
+
y = np.zeros_like(x)
|
167 |
+
|
168 |
+
for f in [f1, f2, f3, f4]:
|
169 |
+
np.putmask(y, cv2.dilate(x, kernel=f) == x, x)
|
170 |
+
|
171 |
+
z = np.zeros_like(y, dtype=np.uint8)
|
172 |
+
z[y > t] = 255
|
173 |
+
return z
|
174 |
|
175 |
def randomize_seed_fn(seed: int, randomize_seed: bool) -> int:
|
176 |
if randomize_seed:
|