pan-yl commited on
Commit
a99c1e3
1 Parent(s): 8ac9ea0

update app and example

Browse files
Files changed (2) hide show
  1. app.py +3 -0
  2. example.py +43 -43
app.py CHANGED
@@ -397,6 +397,9 @@ class ChatBotUI(object):
397
  For example, you might say, "Change the girl's skirt in @123456 to blue." The '@xxxxx' token will facilitate the identification of the specific image, and will be automatically replaced by a special token '{image}' in the instruction.
398
  5. Once your instructions are prepared, please click the "Chat" button to view the edited result in the chat window.
399
  6. **Important** To render text on an image, please ensure to include a space between each letter. For instance, "add text 'g i r l' on the mask area of @xxxxx".
 
 
 
400
  """
401
  gr.Markdown(value=inst)
402
 
 
397
  For example, you might say, "Change the girl's skirt in @123456 to blue." The '@xxxxx' token will facilitate the identification of the specific image, and will be automatically replaced by a special token '{image}' in the instruction.
398
  5. Once your instructions are prepared, please click the "Chat" button to view the edited result in the chat window.
399
  6. **Important** To render text on an image, please ensure to include a space between each letter. For instance, "add text 'g i r l' on the mask area of @xxxxx".
400
+ 7. To implement local editing based on a specified mask, simply click on the image within the chat window to access the image editor. Here, you can draw a mask and then click the 'Submit' button to upload the edited image along with the mask. For inpainting tasks, select the 'Composite' mask type, while for outpainting tasks, choose the 'Outpainting' mask type. For all other local editing tasks, please select the 'Background' mask type.
401
+ 8. If you find our work valuable, we invite you to refer to the [ACE Page](https://ali-vilab.github.io/ace-page/) for comprehensive information.
402
+
403
  """
404
  gr.Markdown(value=inst)
405
 
example.py CHANGED
@@ -17,6 +17,49 @@ def download_image(image, local_path=None):
17
  def get_examples(cache_dir):
18
  print('Downloading Examples ...')
19
  examples = [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  [
21
  'Image Segmentation',
22
  download_image(
@@ -138,15 +181,6 @@ def get_examples(cache_dir):
138
  '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."',
139
  6666
140
  ],
141
- [
142
- 'Controllable Generation',
143
- download_image(
144
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/131ca90fd2a9.png?raw=true',
145
- os.path.join(cache_dir,
146
- 'examples/131ca90fd2a9.jpg')), None, None,
147
- '"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}.',
148
- 613725
149
- ],
150
  [
151
  'Image Denoising',
152
  download_image(
@@ -180,18 +214,6 @@ def get_examples(cache_dir):
180
  'Refashion the mask portion of {image} in accordance with "A yellow egg with a smiling face painted on it"',
181
  6666
182
  ],
183
- [
184
- 'Outpainting',
185
- download_image(
186
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f.png?raw=true',
187
- os.path.join(cache_dir, 'examples/f2b22c08be3f.jpg')),
188
- download_image(
189
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f_mask.png?raw=true',
190
- os.path.join(cache_dir,
191
- 'examples/f2b22c08be3f_mask.jpg')), None,
192
- 'Could the {image} be widened within the space designated by mask, while retaining the original?',
193
- 6666
194
- ],
195
  [
196
  'General Editing',
197
  download_image(
@@ -233,18 +255,6 @@ def get_examples(cache_dir):
233
  os.path.join(cache_dir, 'examples/92751f2e4a0e.jpg')), None,
234
  None, '{image} Remove the smile from his face', 9899999
235
  ],
236
- [
237
- 'Render Text',
238
- download_image(
239
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48.png?raw=true',
240
- os.path.join(cache_dir, 'examples/33e9f27c2c48.jpg')),
241
- download_image(
242
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48_mask.png?raw=true',
243
- os.path.join(cache_dir,
244
- 'examples/33e9f27c2c48_mask.jpg')), None,
245
- 'Put the text "C A T" at the position marked by mask in the {image}',
246
- 6666
247
- ],
248
  [
249
  'Remove Text',
250
  download_image(
@@ -307,16 +317,6 @@ def get_examples(cache_dir):
307
  os.path.join(cache_dir, 'examples/e0f48b3fd010.jpg')), None,
308
  None, 'make {image} to Walt Disney Animation style', 99999
309
  ],
310
- [
311
- 'Style Transfer',
312
- download_image(
313
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/9e73e7eeef55.png?raw=true',
314
- os.path.join(cache_dir, 'examples/9e73e7eeef55.jpg')), None,
315
- download_image(
316
- 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/2e02975293d6.png?raw=true',
317
- os.path.join(cache_dir, 'examples/2e02975293d6.jpg')),
318
- 'edit {image} based on the style of {image1} ', 99999
319
- ],
320
  [
321
  'Try On',
322
  download_image(
 
17
  def get_examples(cache_dir):
18
  print('Downloading Examples ...')
19
  examples = [
20
+ [
21
+ 'Controllable Generation',
22
+ download_image(
23
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/131ca90fd2a9.png?raw=true',
24
+ os.path.join(cache_dir,
25
+ 'examples/131ca90fd2a9.jpg')), None, None,
26
+ '"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}.',
27
+ 613725
28
+ ],
29
+ [
30
+ 'Render Text',
31
+ download_image(
32
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48.png?raw=true',
33
+ os.path.join(cache_dir, 'examples/33e9f27c2c48.jpg')),
34
+ download_image(
35
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/33e9f27c2c48_mask.png?raw=true',
36
+ os.path.join(cache_dir,
37
+ 'examples/33e9f27c2c48_mask.jpg')), None,
38
+ 'Put the text "C A T" at the position marked by mask in the {image}',
39
+ 6666
40
+ ],
41
+ [
42
+ 'Style Transfer',
43
+ download_image(
44
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/9e73e7eeef55.png?raw=true',
45
+ os.path.join(cache_dir, 'examples/9e73e7eeef55.jpg')), None,
46
+ download_image(
47
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/2e02975293d6.png?raw=true',
48
+ os.path.join(cache_dir, 'examples/2e02975293d6.jpg')),
49
+ 'edit {image} based on the style of {image1} ', 99999
50
+ ],
51
+ [
52
+ 'Outpainting',
53
+ download_image(
54
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f.png?raw=true',
55
+ os.path.join(cache_dir, 'examples/f2b22c08be3f.jpg')),
56
+ download_image(
57
+ 'https://github.com/ali-vilab/ace-page/blob/main/assets/examples/f2b22c08be3f_mask.png?raw=true',
58
+ os.path.join(cache_dir,
59
+ 'examples/f2b22c08be3f_mask.jpg')), None,
60
+ 'Could the {image} be widened within the space designated by mask, while retaining the original?',
61
+ 6666
62
+ ],
63
  [
64
  'Image Segmentation',
65
  download_image(
 
181
  '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."',
182
  6666
183
  ],
 
 
 
 
 
 
 
 
 
184
  [
185
  'Image Denoising',
186
  download_image(
 
214
  'Refashion the mask portion of {image} in accordance with "A yellow egg with a smiling face painted on it"',
215
  6666
216
  ],
 
 
 
 
 
 
 
 
 
 
 
 
217
  [
218
  'General Editing',
219
  download_image(
 
255
  os.path.join(cache_dir, 'examples/92751f2e4a0e.jpg')), None,
256
  None, '{image} Remove the smile from his face', 9899999
257
  ],
 
 
 
 
 
 
 
 
 
 
 
 
258
  [
259
  'Remove Text',
260
  download_image(
 
317
  os.path.join(cache_dir, 'examples/e0f48b3fd010.jpg')), None,
318
  None, 'make {image} to Walt Disney Animation style', 99999
319
  ],
 
 
 
 
 
 
 
 
 
 
320
  [
321
  'Try On',
322
  download_image(