Spaces:
Running
on
Zero
Running
on
Zero
File size: 19,539 Bytes
2a00960 65e539d 2a00960 65e539d 2a00960 99958f3 a99c1e3 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 65e539d 2a00960 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# -*- coding: utf-8 -*-
# Copyright (c) Alibaba, Inc. and its affiliates.
import os
from PIL import Image
from scepter.modules.utils.file_system import FS
def download_image(image, local_path=None):
if not FS.exists(local_path):
local_path = FS.get_from(image, local_path=local_path)
if local_path.split(".")[-1] in ['jpg', 'jpeg']:
im = Image.open(local_path).convert("RGB")
im.save(local_path, format='JPEG')
return local_path
def get_examples(cache_dir):
print('Downloading Examples ...')
examples = [
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/e33edc106953.png?raw=true',
os.path.join(cache_dir, 'examples/e33edc106953.jpg')), None,
None, '{image} let the man smile', 6666
],
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/5d2bcc91a3e9.png?raw=true',
os.path.join(cache_dir, 'examples/5d2bcc91a3e9.jpg')), None,
None, 'let the man in {image} wear sunglasses', 9999
],
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/3a52eac708bd.png?raw=true',
os.path.join(cache_dir, 'examples/3a52eac708bd.jpg')), None,
None, '{image} red hair', 9999
],
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/3f4dc464a0ea.png?raw=true',
os.path.join(cache_dir, 'examples/3f4dc464a0ea.jpg')), None,
None, '{image} let the man serious', 99999
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/131ca90fd2a9.png?raw=true',
os.path.join(cache_dir,
'examples/131ca90fd2a9.jpg')), None, None,
'"A person sits contemplatively on the ground, surrounded by falling autumn leaves. Dressed in a green sweater and dark blue pants, they rest their chin on their hand, exuding a relaxed demeanor. Their stylish checkered slip-on shoes add a touch of flair, while a black purse lies in their lap. The backdrop of muted brown enhances the warm, cozy atmosphere of the scene." , generate the image that corresponds to the given scribble {image}.',
613725
],
[
'Render Text',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48.png?raw=true',
os.path.join(cache_dir, 'examples/33e9f27c2c48.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48_mask.png?raw=true',
os.path.join(cache_dir,
'examples/33e9f27c2c48_mask.jpg')), None,
'Put the text "C A T" at the position marked by mask in the {image}',
6666
],
[
'Style Transfer',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/9e73e7eeef55.png?raw=true',
os.path.join(cache_dir, 'examples/9e73e7eeef55.jpg')), None,
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/2e02975293d6.png?raw=true',
os.path.join(cache_dir, 'examples/2e02975293d6.jpg')),
'edit {image} based on the style of {image1} ', 99999
],
[
'Outpainting',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f.png?raw=true',
os.path.join(cache_dir, 'examples/f2b22c08be3f.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f_mask.png?raw=true',
os.path.join(cache_dir,
'examples/f2b22c08be3f_mask.jpg')), None,
'Could the {image} be widened within the space designated by mask, while retaining the original?',
6666
],
[
'Image Segmentation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/db3ebaa81899.png?raw=true',
os.path.join(cache_dir, 'examples/db3ebaa81899.jpg')), None,
None, '{image} Segmentation', 6666
],
[
'Depth Estimation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f1927c4692ba.png?raw=true',
os.path.join(cache_dir, 'examples/f1927c4692ba.jpg')), None,
None, '{image} Depth Estimation', 6666
],
[
'Pose Estimation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/014e5bf3b4d1.png?raw=true',
os.path.join(cache_dir, 'examples/014e5bf3b4d1.jpg')), None,
None, '{image} distinguish the poses of the figures', 999999
],
[
'Scribble Extraction',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/5f59a202f8ac.png?raw=true',
os.path.join(cache_dir, 'examples/5f59a202f8ac.jpg')), None,
None, 'Generate a scribble of {image}, please.', 6666
],
[
'Mosaic',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/3a2f52361eea.png?raw=true',
os.path.join(cache_dir, 'examples/3a2f52361eea.jpg')), None,
None, 'Adapt {image} into a mosaic representation.', 6666
],
[
'Edge map Extraction',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/b9d1e519d6e5.png?raw=true',
os.path.join(cache_dir, 'examples/b9d1e519d6e5.jpg')), None,
None, 'Get the edge-enhanced result for {image}.', 6666
],
[
'Grayscale',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/c4ebbe2ba29b.png?raw=true',
os.path.join(cache_dir, 'examples/c4ebbe2ba29b.jpg')), None,
None, 'transform {image} into a black and white one', 6666
],
[
'Contour Extraction',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/19652d0f6c4b.png?raw=true',
os.path.join(cache_dir,
'examples/19652d0f6c4b.jpg')), None, None,
'Would you be able to make a contour picture from {image} for me?',
6666
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/249cda2844b7.png?raw=true',
os.path.join(cache_dir,
'examples/249cda2844b7.jpg')), None, None,
'Following the segmentation outcome in mask of {image}, develop a real-life image using the explanatory note in "a mighty cat lying on the bed”.',
6666
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/411f6c4b8e6c.png?raw=true',
os.path.join(cache_dir,
'examples/411f6c4b8e6c.jpg')), None, None,
'use the depth map {image} and the text caption "a cut white cat" to create a corresponding graphic image',
999999
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/a35c96ed137a.png?raw=true',
os.path.join(cache_dir,
'examples/a35c96ed137a.jpg')), None, None,
'help translate this posture schema {image} into a colored image based on the context I provided "A beautiful woman Climbing the climbing wall, wearing a harness and climbing gear, skillfully maneuvering up the wall with her back to the camera, with a safety rope."',
3599999
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/dcb2fc86f1ce.png?raw=true',
os.path.join(cache_dir,
'examples/dcb2fc86f1ce.jpg')), None, None,
'Transform and generate an image using mosaic {image} and "Monarch butterflies gracefully perch on vibrant purple flowers, showcasing their striking orange and black wings in a lush garden setting." description',
6666
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/4cd4ee494962.png?raw=true',
os.path.join(cache_dir,
'examples/4cd4ee494962.jpg')), None, None,
'make this {image} colorful as per the "beautiful sunflowers"',
6666
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/a47e3a9cd166.png?raw=true',
os.path.join(cache_dir,
'examples/a47e3a9cd166.jpg')), None, None,
'Take the edge conscious {image} and the written guideline "A whimsical animated character is depicted holding a delectable cake adorned with blue and white frosting and a drizzle of chocolate. The character wears a yellow headband with a bow, matching a cozy yellow sweater. Her dark hair is styled in a braid, tied with a yellow ribbon. With a golden fork in hand, she stands ready to enjoy a slice, exuding an air of joyful anticipation. The scene is creatively rendered with a charming and playful aesthetic." and produce a realistic image.',
613725
],
[
'Controllable Generation',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/d890ed8a3ac2.png?raw=true',
os.path.join(cache_dir,
'examples/d890ed8a3ac2.jpg')), None, None,
'creating a vivid image based on {image} and description "This image features a delicious rectangular tart with a flaky, golden-brown crust. The tart is topped with evenly sliced tomatoes, layered over a creamy cheese filling. Aromatic herbs are sprinkled on top, adding a touch of green and enhancing the visual appeal. The background includes a soft, textured fabric and scattered white flowers, creating an elegant and inviting presentation. Bright red tomatoes in the upper right corner hint at the fresh ingredients used in the dish."',
6666
],
[
'Image Denoising',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/0844a686a179.png?raw=true',
os.path.join(cache_dir,
'examples/0844a686a179.jpg')), None, None,
'Eliminate noise interference in {image} and maximize the crispness to obtain superior high-definition quality',
6666
],
[
'Inpainting',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/fa91b6b7e59b.png?raw=true',
os.path.join(cache_dir, 'examples/fa91b6b7e59b.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/fa91b6b7e59b_mask.png?raw=true',
os.path.join(cache_dir,
'examples/fa91b6b7e59b_mask.jpg')), None,
'Ensure to overhaul the parts of the {image} indicated by the mask.',
6666
],
[
'Inpainting',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/632899695b26.png?raw=true',
os.path.join(cache_dir, 'examples/632899695b26.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/632899695b26_mask.png?raw=true',
os.path.join(cache_dir,
'examples/632899695b26_mask.jpg')), None,
'Refashion the mask portion of {image} in accordance with "A yellow egg with a smiling face painted on it"',
6666
],
[
'General Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/354d17594afe.png?raw=true',
os.path.join(cache_dir,
'examples/354d17594afe.jpg')), None, None,
'{image} change the dog\'s posture to walking in the water, and change the background to green plants and a pond.',
6666
],
[
'General Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/38946455752b.png?raw=true',
os.path.join(cache_dir,
'examples/38946455752b.jpg')), None, None,
'{image} change the color of the dress from white to red and the model\'s hair color red brown to blonde.Other parts remain unchanged',
6669
],
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/3ba5202f0cd8.png?raw=true',
os.path.join(cache_dir,
'examples/3ba5202f0cd8.jpg')), None, None,
'Keep the same facial feature in @3ba5202f0cd8, change the woman\'s clothing from a Blue denim jacket to a white turtleneck sweater and adjust her posture so that she is supporting her chin with both hands. Other aspects, such as background, hairstyle, facial expression, etc, remain unchanged.',
99999
],
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/369365b94725.png?raw=true',
os.path.join(cache_dir, 'examples/369365b94725.jpg')), None,
None, '{image} Make her looking at the camera', 6666
],
[
'Facial Editing',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/92751f2e4a0e.png?raw=true',
os.path.join(cache_dir, 'examples/92751f2e4a0e.jpg')), None,
None, '{image} Remove the smile from his face', 9899999
],
[
'Remove Text',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/8530a6711b2e.png?raw=true',
os.path.join(cache_dir, 'examples/8530a6711b2e.jpg')), None,
None, 'Aim to remove any textual element in {image}', 6666
],
[
'Remove Text',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/c4d7fb28f8f6.png?raw=true',
os.path.join(cache_dir, 'examples/c4d7fb28f8f6.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/c4d7fb28f8f6_mask.png?raw=true',
os.path.join(cache_dir,
'examples/c4d7fb28f8f6_mask.jpg')), None,
'Rub out any text found in the mask sector of the {image}.', 6666
],
[
'Remove Object',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/e2f318fa5e5b.png?raw=true',
os.path.join(cache_dir,
'examples/e2f318fa5e5b.jpg')), None, None,
'Remove the unicorn in this {image}, ensuring a smooth edit.',
99999
],
[
'Remove Object',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/1ae96d8aca00.png?raw=true',
os.path.join(cache_dir, 'examples/1ae96d8aca00.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/1ae96d8aca00_mask.png?raw=true',
os.path.join(cache_dir, 'examples/1ae96d8aca00_mask.jpg')),
None, 'Discard the contents of the mask area from {image}.', 99999
],
[
'Add Object',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/80289f48e511.png?raw=true',
os.path.join(cache_dir, 'examples/80289f48e511.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/80289f48e511_mask.png?raw=true',
os.path.join(cache_dir,
'examples/80289f48e511_mask.jpg')), None,
'add a Hot Air Balloon into the {image}, per the mask', 613725
],
[
'Style Transfer',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/d725cb2009e8.png?raw=true',
os.path.join(cache_dir, 'examples/d725cb2009e8.jpg')), None,
None, 'Change the style of {image} to colored pencil style', 99999
],
[
'Style Transfer',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/e0f48b3fd010.png?raw=true',
os.path.join(cache_dir, 'examples/e0f48b3fd010.jpg')), None,
None, 'make {image} to Walt Disney Animation style', 99999
],
[
'Try On',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/ee4ca60b8c96.png?raw=true',
os.path.join(cache_dir, 'examples/ee4ca60b8c96.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/ee4ca60b8c96_mask.png?raw=true',
os.path.join(cache_dir, 'examples/ee4ca60b8c96_mask.jpg')),
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/ebe825bbfe3c.png?raw=true',
os.path.join(cache_dir, 'examples/ebe825bbfe3c.jpg')),
'Change the cloth in {image} to the one in {image1}', 99999
],
[
'Workflow',
download_image(
'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/cb85353c004b.png?raw=true',
os.path.join(cache_dir, 'examples/cb85353c004b.jpg')), None,
None, '<workflow> ice cream {image}', 99999
],
]
print('Finish. Start building UI ...')
return examples
|